recursive-hashcode ( n obj quot -- code )


Vocabulary
combinators

Inputs and outputs
nan integer
objan object
quota quotation with stack effect ( n obj -- code )
codean integer


Word description
A combinator used to implement methods for the hashcode* generic word. If n is less than or equal to zero, outputs 0, otherwise calls the quotation.

Definition
USING: kernel math ;

IN: combinators

: recursive-hashcode ( n obj quot -- code )
pick 0 <= [ 3drop 0 ] [ [ 1 - ] 2dip call ] if ; inline