]> gitweb.factorcode.org Git - factor.git/blobdiff - core/math/math.factor
kernel: move recusrive-hashcode to math and add test
[factor.git] / core / math / math.factor
index c88f274141b506b8bb051b9343ee9b6b43ffdff3..869d0aa133261075d9f419eb25d813d9f07d3770 100644 (file)
@@ -131,6 +131,9 @@ GENERIC: (log2) ( x -- n ) foldable
 
 PRIVATE>
 
+: recursive-hashcode ( n obj quot -- code )
+    pick 0 <= [ 3drop 0 ] [ [ 1 - ] 2dip call ] if ; inline
+
 ERROR: log2-expects-positive x ;
 
 : log2 ( x -- n )