PageRenderTime 26ms CodeModel.GetById 16ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/core/classes/builtin/builtin.factor

http://github.com/abeaumont/factor
Unknown | 30 lines | 18 code | 12 blank | 0 comment | 0 complexity | b04448f8e4a5ee36b80d945776e832cd MD5 | raw file
 1! Copyright (C) 2004, 2010 Slava Pestov.
 2! See http://factorcode.org/license.txt for BSD license.
 3USING: classes classes.algebra.private classes.private kernel
 4kernel.private make namespaces sequences words ;
 5IN: classes.builtin
 6
 7SYMBOL: builtins
 8
 9PREDICATE: builtin-class < class
10    "metaclass" word-prop builtin-class eq? ;
11
12: class>type ( class -- n ) "type" word-prop ; foldable
13
14: type>class ( n -- class ) builtins get-global nth ; foldable
15
16: bootstrap-type>class ( n -- class ) builtins get nth ;
17
18M: object class-of tag type>class ; inline
19
20M: builtin-class rank-class drop 0 ;
21
22M: builtin-class instance? [ tag ] [ class>type ] bi* eq? ;
23
24M: builtin-class (flatten-class) dup ,, ;
25
26M: builtin-class (classes-intersect?) eq? ;
27
28: full-cover ( -- ) builtins get [ (flatten-class) ] each ;
29
30M: anonymous-complement (flatten-class) drop full-cover ;