It is easy to modify the function to a dyadic form so the basic elements are 
sets, sets of sets, etc by specifying a left argument.  Raul's point however 
remains, above that level all items are regarded as sets.

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

Fraser
----- Original Message ----- 
From: "Raul Miller" <[email protected]>
To: "Programming forum" <[email protected]>
Sent: Thursday, August 06, 2009 3:19 AM
Subject: Re: [Jprogramming] J Sets


On Tue, Aug 4, 2009 at 10:58 PM, Fraser
Jackson<[email protected]> wrote:
> 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.
> )

We can provide tacit forms easily enough.  For example:

Set=: /:~...@~.
sortSetR=: Set@($:&.>^:(*...@l.))

   (sortSet -: sortSetR) 5!:2 <'sortSet'
1

But note that this assumes that if you are working with
sets of sets, only level 0 items of arrays are anything
other than sets.

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


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

Reply via email to