1 ! Copyright (C) 2008, 2010 Doug Coleman, Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: classes classes.algebra.private classes.predicate
4 classes.predicate.private kernel sequences words ;
9 : singleton-predicate-quot ( class -- quot ) [ eq? ] curry ;
13 PREDICATE: singleton-class < predicate-class
14 [ "predicate-definition" word-prop ]
15 [ singleton-predicate-quot ]
18 : define-singleton-class ( word -- )
19 \ word over singleton-predicate-quot define-predicate-class ;
21 M: singleton-class instance? eq? ;
23 M: singleton-class (classes-intersect?)
24 over singleton-class? [ eq? ] [ call-next-method ] if ;
26 M: singleton-class predicate-quot
27 singleton-predicate-quot ;