1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% _ __ __ _
(_
)_ __
| (_
)___
| |_
4 %% | '_ \ / _` | | '__
| | / __
| __
|
5 %% | |_
) | (_
| | | | | | \__ \
|_
6 %% | .__
/ \__,_|_|_| |_|_|___/\__
|
9 %% * author
: Tom Schrijvers
24 fst_of_pairs
([X
-_
|XYs
],[X
|Xs
]) :-
28 snd_of_pairs
([_
-Y
|XYs
],[Y
|Ys
]) :-
32 pairup
([X
|Xs
],[Y
|Ys
],[X
-Y
|XYs
]) :-
35 lookup
([K
- V
| KVs
],Key
,Value
) :-
42 lookup_any
([K
- V
| KVs
],Key
,Value
) :-
47 lookup_any
(KVs
,Key
,Value
)
50 lookup_eq
([K
- V
| KVs
],Key
,Value
) :-
54 lookup_eq
(KVs
,Key
,Value
)
57 lookup_any_eq
([K
- V
| KVs
],Key
,Value
) :-
62 lookup_any_eq
(KVs
,Key
,Value
)
66 translate
([X
|Xs
],Dict
,[Y
|Ys
]) :-
68 translate
(Xs
,Dict
,Ys
).
70 pairlist_delete
([], _
, []).
71 pairlist_delete
([K
- V
| KVs
], Key
, PL
) :-
76 pairlist_delete
(KVs
, Key
, T
)
79 pairlist_delete_all
([], _
, []).
80 pairlist_delete_all
([K
- V
| KVs
], Key
, PL
) :-
82 pairlist_delete_all
(KVs
, Key
, PL
)
86 pairlist_delete_all
(KVs
, Key
, T
)
89 pairlist_delete_eq
([], _
, []).
90 pairlist_delete_eq
([K
- V
| KVs
], Key
, PL
) :-
95 pairlist_delete_eq
(KVs
, Key
, T
)
98 pairlist_delete_all_eq
([], _
, []).
99 pairlist_delete_all_eq
([K
- V
| KVs
], Key
, PL
) :-
101 pairlist_delete_all_eq
(KVs
, Key
, PL
)
104 pairlist_delete_all_eq
(KVs
, Key
, T
)