heaps: make data-first throw on empty.

db4
John Benediktsson 2014-12-13 16:01:20 -08:00
parent 46e0426795
commit 68b662c44c
1 changed files with 1 additions and 1 deletions

View File

@ -62,7 +62,7 @@ M: heap heap-size ( heap -- n )
data>> nth-unsafe { entry } declare ; inline data>> nth-unsafe { entry } declare ; inline
: data-first ( heap -- entry ) : data-first ( heap -- entry )
0 swap data-nth ; inline data>> first ; inline
: data-set-nth ( entry n heap -- ) : data-set-nth ( entry n heap -- )
[ [ >>index ] keep ] dip data>> set-nth-unsafe ; inline [ [ >>index ] keep ] dip data>> set-nth-unsafe ; inline