[eclipse-users] Fast lookup mapping.

From: Malcolm Ryan <malcolmr_at_...25...>
Date: Tue, 27 Mar 2007 14:16:43 +1000
I'm looking for a prolog data-structure which implements O(1) lookup  
on keys, and which can take a prolog variable as a possible key. That  
is, I want it to be functionally equivalent to:

get(X, [(Key,Value) | _], Value) :-
	X == Key, !.

get(X, [_, Tail], Value) :-
	get(X, Tail, Value).

The use of '==' is important.

Malcolm

--
Many clever men like you have trusted to civilisation.
Many clever Babylonians, many clever Egyptians,
Many clever men at the end of Rome.
                               - G.K.Chesterton, The Napoleon of  
Notting Hill
Received on Tue Mar 27 2007 - 05:16:57 CEST

This archive was generated by hypermail 2.2.0 : Mon Jul 09 2018 - 02:05:29 CEST