Kip Murray proposed:
>  Proposal -- A "set" is a list of boxes, without duplicates, 
>  with tail <i.0 0 and curtail sorted.  You can think of the 
>  tail as a "set marker" that permits the empty set to be a 
>  non-empty list.  Sorting the curtail makes it easer to test 
>  whether a set is an element of another set and whether two 
>  sets have the same elements and so are regarded as the same set.

Kip,

Reading in more detail, I'm not sure you need to provide a format for sets to 
your users.  You could rewrite your functions to
apply to any array, by handling some details under the covers.  For example:

   U       =:  ~.@:,
   N       =:  [ -. -.
   is      =:  -:&:(/:~)&:~.
   less    =:  -.
   isEmpty =:  -: 0&#

This might be more convenient for your users, and might enjoy some performance 
benefits (e.g. when the elements of a set are
homogenous & wouldn't need to be boxed).

But you've obviously thought about this more than I have.  Can you describe how 
you arrived at your representation?  What were
your motives?  

It might be easier to design these set functions in the context of an 
application.  Do you have one in mind?

-Dan

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

Reply via email to