On 8/31/12, June Kim (김창준) <[email protected]> wrote:
> I'm trying to emulate e.(member in) with a combination of +/ and =/
>
> So far so good. However, when x is not an array, it gets broken:

You should swap the two arguments of (=/) and then it gets easier.  See.


   elt =: [: +./ =/~
   'n' elt 'green'
1
   'n' e. 'green'
1
   'o' elt 'green'
0
   'o' e. 'green'
0
   'efgh' elt 'green'
1 0 1 0
   'efgh' e. 'green'
1 0 1 0
   (3 3$'abcdefghi') elt 'green'
0 0 0
0 1 0
1 0 0
   (3 3$'abcdefghi') e. 'green'
0 0 0
0 1 0
1 0 0



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

Reply via email to