Here is a puzzle:

    ]e1 =: allsubsets 'ab'
++-+-+--+
||b|a|ab|
++-+-+--+
    ]e2 =: '';'b';'a';'ab'
++-+-+--+
||b|a|ab|
++-+-+--+
    e1 isequalset e2
0
    e1 -: e2
0
    e1 = e2
1 0 0 1

I "know the answer" but don't know the cure.

For reference:

    allsubsets =: 3 : 0    NB.  An explicit alternative to Raul's neat form.
if. isemptyset y do. a:
  else.
  (#&y) &.> ( <"1 (#: i.2^#y))
end.
)
    isequalset =: isin~ *. isin

    isin =: *./ @ e.

I believe verb isemptyset is irrelevant and don't list it here.


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

Reply via email to