2008-10-02 18:33:26 -04:00
|
|
|
USING: words kernel sequences locals
|
2008-05-10 17:05:20 -04:00
|
|
|
locals.private accessors parser namespaces continuations
|
2008-07-07 20:36:33 -04:00
|
|
|
summary definitions generalizations arrays ;
|
2008-05-10 17:05:20 -04:00
|
|
|
IN: descriptive
|
|
|
|
|
2008-05-11 01:36:38 -04:00
|
|
|
ERROR: descriptive-error args underlying word ;
|
2008-05-10 17:05:20 -04:00
|
|
|
|
2008-05-11 01:36:38 -04:00
|
|
|
M: descriptive-error summary
|
2008-06-28 03:36:20 -04:00
|
|
|
word>> "The " swap name>> " word encountered an error."
|
2008-05-10 17:05:20 -04:00
|
|
|
3append ;
|
|
|
|
|
2008-05-10 21:17:24 -04:00
|
|
|
<PRIVATE
|
2008-05-10 17:05:20 -04:00
|
|
|
: rethrower ( word inputs -- quot )
|
2008-05-10 21:17:24 -04:00
|
|
|
[ length ] keep [ >r narray r> swap 2array flip ] 2curry
|
2008-05-11 01:36:38 -04:00
|
|
|
[ 2 ndip descriptive-error ] 2curry ;
|
2008-05-10 17:05:20 -04:00
|
|
|
|
|
|
|
: [descriptive] ( word def -- newdef )
|
|
|
|
swap dup "declared-effect" word-prop in>> rethrower
|
|
|
|
[ recover ] 2curry ;
|
2008-05-10 21:17:24 -04:00
|
|
|
PRIVATE>
|
2008-05-10 17:05:20 -04:00
|
|
|
|
|
|
|
: define-descriptive ( word def -- )
|
|
|
|
[ "descriptive-definition" set-word-prop ]
|
|
|
|
[ dupd [descriptive] define ] 2bi ;
|
|
|
|
|
|
|
|
: DESCRIPTIVE:
|
|
|
|
(:) define-descriptive ; parsing
|
|
|
|
|
2008-05-11 01:36:38 -04:00
|
|
|
PREDICATE: descriptive < word
|
2008-05-10 17:05:20 -04:00
|
|
|
"descriptive-definition" word-prop ;
|
|
|
|
|
2008-05-11 01:36:38 -04:00
|
|
|
M: descriptive definer drop \ DESCRIPTIVE: \ ; ;
|
2008-05-10 17:05:20 -04:00
|
|
|
|
2008-05-11 01:36:38 -04:00
|
|
|
M: descriptive definition
|
2008-05-10 17:05:20 -04:00
|
|
|
"descriptive-definition" word-prop ;
|
|
|
|
|
|
|
|
: DESCRIPTIVE::
|
|
|
|
(::) define-descriptive ; parsing
|
|
|
|
|
2008-05-11 01:36:38 -04:00
|
|
|
INTERSECTION: descriptive-lambda descriptive lambda-word ;
|
2008-05-10 17:05:20 -04:00
|
|
|
|
|
|
|
M: descriptive-lambda definer drop \ DESCRIPTIVE:: \ ; ;
|
|
|
|
|
|
|
|
M: descriptive-lambda definition
|
|
|
|
"lambda" word-prop body>> ;
|