Kip,

You seem to keep wanting to create new data objects when I do not believe 
they are necessary.

In J it is perfectly possible to have a sequence and a set having exactly 
the same representation.  A lot of set theory is concerned with sequences. 
They may be sequences of atoms, or sequences of sets.  Having set verbs and 
sequence verbs operating on these objects is the direction I would go.  That 
means of course that the order of items in the list of elements may matter.

At an earlier stage in this discussion you suggested that it would be 
difficult to sort elements and test identity in sets of sets if the elements 
were not in a standard order.

I think the following function will achieve that by sorting into a J sort 
order.  That provides a standard form to simplify testing.  Raul might 
provide a tacit form.

   sortSet =: 3 : 0
s =. y
for_k. i. >: L. y do.   s =. Set L:k s end.
)

The following gives an example of what it does  - you need to copy and 
execute it to see its results - my mailer seems to really mishandle boxing.

   s1 =: 'bdca'
   s2 =: powSet s1
   s2a =: 0 13 3 6 {s2
   s2b =: 1 13 5 2 {s2
   s3a =:  2 5 9 13 { powSet s2a
   s3b =:  2 5 9 13 { powSet s2b

   sc =:  |. s1;s2a;<s3a
   sd =:  |. s1;s2b;<s3b

    sc
   sortSet sc
   sd
   sortSet sd

You can get other results by converting sortSet to a dyadic verb and 
specifying the levels at which sorting will be done.

Fraser


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

Reply via email to