zuse: change name of +ordered-map to +on and add alias, change name of +traverse to +dip as per talk with ted
=/ b ;;((tree [key=key val=value]) a)
?> (apt:((ordered-map key value) ord) b)
b
-:: +ordered-map: treap with user-specified horizontal order
+++ ordered-map on
+:: +on: treap with user-specified horizontal order, ordered-map
::
:: Conceptually smaller items go on the left, so the item with the
:: smallest key can be popped off the head. If $key is `@` and
:: WARNING: ordered-map will not work properly if two keys can be
:: unequal under noun equality but equal via the compare gate
::
-++ ordered-map
+++ on
+ ~/ %on
|* [key=mold val=mold]
=> |%
+$ item [key=key val=val]
--
:: +compare: item comparator for horizontal order
::
+ ~% %comp +>+ ~
|= compare=$-([key key] ?)
- ~% %ordered-map ..part ~
+ ~% %core + ~
|%
:: +all: apply logical AND boolean test on all values
::
?~ a b
::
$(a l.a, b [n.a $(a r.a)])
- :: +traverse: stateful partial inorder traversal
+ :: +dip: stateful partial inorder traversal
::
:: Mutates .state on each run of .f. Starts at .start key, or if
:: .start is ~, starts at the head (item with smallest key). Stops
:: keys. Each run of .f can replace an item's value or delete the
:: item.
::
- ++ traverse
- ~/ %traverse
+ ++ dip
+ ~/ %dip
|* state=mold
|= $: a=(tree item)
=state
