[m-rev.] for review: list_util and map_util
Zoltan Somogyi
zs at cs.mu.OZ.AU
Fri Jun 13 16:32:57 AEST 2003
During a conversation with Fergus, we agreed that it would be a good idea
to move predicates and functions in list.m and map.m that are used by the
compiler but are not all that generally useful to new modules. I therefore
propose to set up two new modules, list_util.m and map_util.m, and I propose
that their initial contents be the following:
map_util:
:- pred lower_bound_search((map.map(K, V)), K, K, V).
:- pred lower_bound_lookup((map.map(K, V)), K, K, V).
:- pred upper_bound_search((map.map(K, V)), K, K, V).
:- pred upper_bound_lookup((map.map(K, V)), K, K, V).
:- pred inverse_search((map.map(K, V)), V, K).
:- pred remove_smallest((map.map(K, V)), K, V, (map.map(K, V))).
:- pred foldl2(pred(K, V, T, T, U, U), (map.map(K, V)), T, T, U, U).
:- func common_subset((map.map(K, V)), (map.map(K, V))) = (map.map(K, V)).
list_util:
:- pred map2(pred(A, B, C), (list.list(A)), (list.list(B)), (list.list(C))).
:- pred map3(pred(A, B, C, D), (list.list(A)), (list.list(B)), (list.list(C)), (list.list(D))).
:- func map_corresponding3((func(A, B, C) = D), (list.list(A)), (list.list(B)), (list.list(C))) = (list.list(D)).
:- func filter_map_corresponding((func(A, B) = C), (list.list(A)), (list.list(B))) = (list.list(C)).
:- func filter_map_corresponding3((func(A, B, C) = D), (list.list(A)), (list.list(B)), (list.list(C))) = (list.list(D)).
:- pred foldl2(pred(X, Y, Y, Z, Z), (list.list(X)), Y, Y, Z, Z).
:- pred foldl3(pred(L, A1, A1, A2, A2, A3, A3), (list.list(L)), A1, A1, A2, A2, A3, A3).
:- pred map2_foldl(pred(X, Y1, Y2, Z, Z), (list.list(X)), (list.list(Y1)), (list.list(Y2)), Z, Z).
:- pred map_foldl2(pred(X, Y, A, A, B, B), (list.list(X)), (list.list(Y)), A, A, B, B).
:- func series(T, (pred T), ((func T) = T)) = (list.list(T)).
:- func ..(int, int) = (list.list(int)).
(The above are extracts from map.int and list.int respectively.)
Any comments?
Zoltan.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list