> Conceptually, this is a verb to tell if a name has a local definition:
Concretely, this verb will tell you which names are local (ignoring the problem
of locales):
isLocal =: ((_1: < nc) *. verb define)@:(;:^:(0 -: L.))
here =. coname ''
ALL_NAMES =. ; 3 : '<nl__y 0 # , y =. y. '"0 here , |. copath here
-. ALL_NAMES e.~ ;:^:(0 -: L.) y.
)
GLOBAL =: +/
LOCAL =. +/
isLocal 'GLOBAL LOCAL UNDEFINED_NAME' NB. Returns 0 1 0
3 : 'isLocal ''W y''[W=:99' 0 NB. Returns 0 1
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm