1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% _ __ __ _
(_
)_ __
| (_
)___
| |_
4 %% | '_ \ / _` | | '__
| | / __
| __
|
5 %% | |_
) | (_
| | | | | | \__ \
|_
6 %% | .__
/ \__,_|_|_| |_|_|___/\__
|
9 %% * author
: Tom Schrijvers
23 fst_of_pairs
([X
-_
|XYs
],[X
|Xs
]) :-
27 snd_of_pairs
([_
-Y
|XYs
],[Y
|Ys
]) :-
31 pairup
([X
|Xs
],[Y
|Ys
],[X
-Y
|XYs
]) :-
34 lookup
([K
- V
| KVs
],Key
,Value
) :-
41 lookup_any
([K
- V
| KVs
],Key
,Value
) :-
46 lookup_any
(KVs
,Key
,Value
)
49 lookup_eq
([K
- V
| KVs
],Key
,Value
) :-
53 lookup_eq
(KVs
,Key
,Value
)
56 lookup_any_eq
([K
- V
| KVs
],Key
,Value
) :-
61 lookup_any_eq
(KVs
,Key
,Value
)
65 translate
([X
|Xs
],Dict
,[Y
|Ys
]) :-
67 translate
(Xs
,Dict
,Ys
).
70 delete([K
- V
| KVs
], Key
, PL
) :-
78 delete_all
([], _
, []).
79 delete_all
([K
- V
| KVs
], Key
, PL
) :-
81 delete_all
(KVs
, Key
, PL
)
85 delete_all
(KVs
, Key
, T
)
89 delete_eq
([K
- V
| KVs
], Key
, PL
) :-
94 delete_eq
(KVs
, Key
, T
)
97 delete_all_eq
([], _
, []).
98 delete_all_eq
([K
- V
| KVs
], Key
, PL
) :-
100 delete_all_eq
(KVs
, Key
, PL
)
103 delete_all_eq
(KVs
, Key
, T
)