After a little bit of thought, here's an approach to resolving the "I
want my x and y" issue:

mynames_z_=: names@namelist  : (names namelist)

This of course, leaves the existing definition of 'names' in place,
with all of its features.

Meanwhile, mynames does almost the same thing, and reports on the
presence of x and y.

If you wanted a complete equivalent, you could:

empty_z_=: 0 -: #@,
numeric_z_=: 0 -: {.@#~&0@,
mynamelist_z_=: namelist^:numeric@(0 1 2 3"_^:empty)

mynames_z_=: names@mynamelist :(names mynamelist)

If you also wanted to eliminate the original definition of names, you
would need to define a new word that does the filtering part.

Or, once you had the above definitions, you could do something like:

names_z_=: mynames f.

(And note that if you use this approach it does not matter what locale
they were originally defined in.)  The result is a bit bulky, and hard
to read, but it works.

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to