heaps: Add >min-heap, >max-heap.

db4
Doug Coleman 2013-03-31 19:01:04 -07:00
parent c74939e43b
commit bfe0ace611
1 changed files with 6 additions and 0 deletions

View File

@ -194,3 +194,9 @@ ERROR: not-a-heap obj ;
[ check-heap ] dip over heap-empty? [ 2drop ] [
[ [ heap-pop drop ] dip call ] [ slurp-heap ] 2bi
] if ; inline recursive
: >min-heap ( assoc -- min-heap )
<min-heap> [ heap-push-all ] keep ;
: >max-heap ( assoc -- min-heap )
<max-heap> [ heap-push-all ] keep ;