define-tuple-predicate ( class -- ) (original) (raw)

define-tuple-predicate ( class -- )

Vocabulary
classes.tuple.private

Inputs

class a tuple-class

Outputs
None

Word description
Defines a predicate word that tests if the top of the stack is an instance of class. This will only work if class is a tuple class.

Notes
Calling this word directly is not necessary in most cases. Higher-level words call it automatically.

Definition

USING: classes combinators kernel ;

IN: classes.tuple.private

: define-tuple-predicate ( class -- )
dup dup echelon-of {
{ 1 [ tuple-predicate-quot/1 ] }
[ tuple-predicate-quot ]
} case define-predicate ;