]> gitweb.factorcode.org Git - factor.git/commitdiff
heaps: make data-first throw on empty.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sun, 14 Dec 2014 00:01:20 +0000 (16:01 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 14 Dec 2014 00:01:20 +0000 (16:01 -0800)
basis/heaps/heaps.factor

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