Kip Murray wrote:
> In private correspondence it has been suggested that elements
> be required to satisfy [: -. 0 e. $ -- that is, no empty
> array may be an element. What do you think?
If this implies that the empty set is represented by '' then I think this is
the only sensible way to go. I'm not sure that's
what it implies [1], but I'm going to talk about that idea anyway.
Using '' to represent the empty set is strongly in the J tradition [2] and
plays to its strengths. For example, you won't have
to implement "intersection with the empty set", "union with the empty set", "is
the empty set a subset of S?" etc. Those
definitions will fall out naturally from the definitions on "normal" sets,
because of the way J is designed.
Transparent handling of edge cases like this is one reason coding in J is such
a joy.
-Dan
[1] If I had a verb that worked on trade cubes represented as Symbol x Price x
Time then I might want to pass it the set of all
trades after 4pm (last dim is 0) empty, or the set of all trades on IBM over
$10,000 (middle dim is 0), or the set of all trades
on the symbol JFORUM (first dim is 0). Can I use your definitions to represent
these sets?
[2] For example:
NB. Give me the set of all letters after c
'c' (] }.~ 1 + i.~) 'abcdefg'
defg
NB. Give me the set of all letters after f
'f' (] }.~ 1 + i.~) 'abcdefg'
g
NB. Give me the set of all letters after g
'f' (] }.~ 1 + i.~) 'abcdefg'
This falls out of the definition that x i. y is #y when -.x e. y . For
extra credit, rewrite it to take advantage of the
similarly useful fact that _=<./'' or __=>./'' .
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm