keys_to_list
This commit is contained in:
parent
c0cf2b0b83
commit
1a78144190
@ -44,6 +44,8 @@
|
||||
rb_key_fold/4,
|
||||
list_to_rbtree/2,
|
||||
ord_list_to_rbtree/2,
|
||||
keys_to_rbtree/2,
|
||||
ord_keys_to_rbtree/2,
|
||||
is_rbtree/1,
|
||||
rb_size/2,
|
||||
rb_in/3
|
||||
@ -1023,13 +1025,31 @@ keys(black(L,K,_,R),L0,Lf) :-
|
||||
keys(R,L0,L1).
|
||||
|
||||
|
||||
%% list_to_rbtree(+L, -T) is det.
|
||||
%
|
||||
% T is the red-black tree corresponding to the mapping in list L.
|
||||
|
||||
keys_to_rbtree(List, T) :-
|
||||
sort(List,Sorted),
|
||||
ord_keys_to_rbtree(Sorted, T).
|
||||
|
||||
%% list_to_rbtree(+L, -T) is det.
|
||||
%
|
||||
% T is the red-black tree corresponding to the mapping in list L.
|
||||
|
||||
list_to_rbtree(List, T) :-
|
||||
sort(List,Sorted),
|
||||
ord_list_to_rbtree(Sorted, T).
|
||||
ord_keys_to_rbtree(List, T) :-
|
||||
maplist(paux, List, Sorted),
|
||||
ord_list_to_rbtree(Sorted, T).
|
||||
|
||||
paux(K, K-_).
|
||||
|
||||
%% list_to_rbtree(+L, -T) is det.
|
||||
%
|
||||
% T is the red-black tree corresponding to the mapping in list L.
|
||||
|
||||
list_to_rbtree(List, T) :-
|
||||
sort(List,Sorted),
|
||||
ord_list_to_rbtree(Sorted, T).
|
||||
|
||||
%% ord_list_to_rbtree(+L, -T) is det.
|
||||
%
|
||||
@ -1434,4 +1454,3 @@ with _NewVal_. Fails if it cannot find _Key_ in _T_.
|
||||
*/
|
||||
|
||||
%%! @}
|
||||
|
||||
|
Reference in New Issue
Block a user