vocabs: adding 'parent-vocab?' and 'parent-vocabs'.
parent
82e34082ec
commit
46df742317
|
@ -3,3 +3,11 @@ USING: vocabs tools.test ;
|
|||
IN: vocabs.tests
|
||||
|
||||
[ f ] [ "kernel" vocab-main ] unit-test
|
||||
|
||||
[ t ] [ "" "" child-vocab? ] unit-test
|
||||
[ t ] [ "" "io.files" child-vocab? ] unit-test
|
||||
[ t ] [ "io" "io.files" child-vocab? ] unit-test
|
||||
[ f ] [ "io.files" "io" child-vocab? ] unit-test
|
||||
|
||||
[ t ] [ "io.files" "io" parent-vocab? ] unit-test
|
||||
[ f ] [ "io" "io.files" parent-vocab? ] unit-test
|
||||
|
|
|
@ -111,6 +111,12 @@ ERROR: no-vocab name ;
|
|||
: child-vocabs ( vocab -- seq )
|
||||
vocab-name vocabs [ child-vocab? ] with filter ;
|
||||
|
||||
: parent-vocab? ( suffix name -- ? )
|
||||
swap child-vocab? ;
|
||||
|
||||
: parent-vocabs ( vocab -- seq )
|
||||
vocab-name vocabs [ parent-vocab? ] with filter ;
|
||||
|
||||
GENERIC: >vocab-link ( name -- vocab )
|
||||
|
||||
M: vocab-spec >vocab-link ;
|
||||
|
|
Loading…
Reference in New Issue