Rename predicate-word to create-predicate-word and add a new predicate-word word
parent
bd479db2f8
commit
4f68808a72
|
@ -37,9 +37,12 @@ PREDICATE: class < word "class" word-prop ;
|
||||||
|
|
||||||
: classes ( -- seq ) implementors-map get keys ;
|
: classes ( -- seq ) implementors-map get keys ;
|
||||||
|
|
||||||
: predicate-word ( word -- predicate )
|
: create-predicate-word ( word -- predicate )
|
||||||
[ name>> "?" append ] [ vocabulary>> ] bi create ;
|
[ name>> "?" append ] [ vocabulary>> ] bi create ;
|
||||||
|
|
||||||
|
: predicate-word ( word -- predicate )
|
||||||
|
"predicate" word-prop first ;
|
||||||
|
|
||||||
PREDICATE: predicate < word "predicating" word-prop >boolean ;
|
PREDICATE: predicate < word "predicating" word-prop >boolean ;
|
||||||
|
|
||||||
M: predicate forget*
|
M: predicate forget*
|
||||||
|
@ -49,8 +52,7 @@ M: predicate reset-word
|
||||||
[ call-next-method ] [ f "predicating" set-word-prop ] bi ;
|
[ call-next-method ] [ f "predicating" set-word-prop ] bi ;
|
||||||
|
|
||||||
: define-predicate ( class quot -- )
|
: define-predicate ( class quot -- )
|
||||||
[ "predicate" word-prop first ] dip
|
[ predicate-word ] dip (( object -- ? )) define-declared ;
|
||||||
(( object -- ? )) define-declared ;
|
|
||||||
|
|
||||||
: superclass ( class -- super )
|
: superclass ( class -- super )
|
||||||
#! Output f for non-classes to work with algebra code
|
#! Output f for non-classes to work with algebra code
|
||||||
|
@ -144,7 +146,7 @@ M: sequence implementors [ implementors ] gather ;
|
||||||
[ ]
|
[ ]
|
||||||
} cleave
|
} cleave
|
||||||
] dip [ assoc-union ] curry change-props
|
] dip [ assoc-union ] curry change-props
|
||||||
dup predicate-word
|
dup create-predicate-word
|
||||||
[ 1quotation "predicate" set-word-prop ]
|
[ 1quotation "predicate" set-word-prop ]
|
||||||
[ swap "predicating" set-word-prop ]
|
[ swap "predicating" set-word-prop ]
|
||||||
[ drop t "class" set-word-prop ]
|
[ drop t "class" set-word-prop ]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
! Copyright (C) 2008 Slava Pestov.
|
! Copyright (C) 2008, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: parser vocabs.parser words kernel classes compiler.units lexer ;
|
USING: parser vocabs.parser words kernel classes compiler.units lexer ;
|
||||||
IN: classes.parser
|
IN: classes.parser
|
||||||
|
@ -9,7 +9,7 @@ IN: classes.parser
|
||||||
: create-class-in ( string -- word )
|
: create-class-in ( string -- word )
|
||||||
current-vocab create
|
current-vocab create
|
||||||
dup save-class-location
|
dup save-class-location
|
||||||
dup predicate-word dup set-word save-location ;
|
dup create-predicate-word dup set-word save-location ;
|
||||||
|
|
||||||
: CREATE-CLASS ( -- word )
|
: CREATE-CLASS ( -- word )
|
||||||
scan create-class-in ;
|
scan create-class-in ;
|
||||||
|
|
Loading…
Reference in New Issue