Hmm... Maybe this is the way to go. It appears E below is the only empty
_set_
although there are other empties. I forget now why I wanted the set-marker <i.
0 0 .
("Other empties" is one reason I don't want _open_ sets. Do you remember your
powSet reporting different empty subsets for differently shaped open arrays?)
load 'validate'
isset =: isvector *. isboxed +. -:&''
isset M =: 0;1
1
isset E =: M -. M NB. empty set
1
E -: $0
1
match1 =: -: *. -:&datatype NB. verb datatype is from stdlib.ijs
E match1 $0
0
But I'm not serious about match1, which uses 3!:0 to "look under the covers".
As Jack Benny said in his famous joke, "I'm thinking it over!"
What do you think of sets with repeated elements? Have you considered what
union, intersection, and difference should mean for such sets?
Kip
Raul Miller wrote:
> On Tue, Aug 11, 2009 at 12:47 AM, Kip Murray<[email protected]> wrote:
>> My main motives are a desire to have a unique empty set (as in set theory)
>> and
>> not to allow sets which are elements of themselves (they lead to a famous
>> paradox in set theory, and might lead to infinite loops in J -- I'm not sure
>> of
>> that).
>
> I think you get this with most enumerated representation of sets in J.
> For example, if you represent a set as a list of boxes where each box
> contains an element of the set, the empty set is unique (it would be the
> empty list) and the set can not contain itself (since a box can not contain
> the list which contains the box).
>
> FYI,
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm