cs450a03@uc780.umd.edu (03/27/91)
Experimenting with J to find out what its definition is is
educational, but at times I wish I had a more thorough definition of
what it's doing.
Of course, J changes so fast such things might be considered silly 8-)
Anyways, here's what I've come up with for what J is doing with the
words function (;:):
This is what you apply ;: to. Result is a list of the words (in the
same order they originally appeared). As is usual for this
sort of thing, rules apply to the largest sequence possible.
sentence =:: (BEGINING_OF_LINE *space *(word *space) END_OF_LINE)
word =:: [(alpha *[alpha numeric] *dot)
(glyph *dot)
(numeric *[alpha numeric] +dot)
(numeric *[alpha (decimal numeric) numeric (space numeric)])
(quote *[quotable (quote quote)] quote)]
---------------------------- character sets ----------------------------
alpha =:: [a-zA-Z]
decimal =:: [.]
dot =:: [.:]
glyph =:: [!-&(-,---/<-@[-`{-~]
numeric =:: [_0-9]
quote =:: [']
quotable =:: [^']
space =:: [ \t]
Notes: except for decimal, and quotable, all character sets are unique.
I haven't tried control characters and ascii characters beyond
~, but I suspect they should be considered "glyphs"
\t represents a tab character
- between two characters represents a range of ascii characters
() indicates serial ordering
[] indicates any of the options
^ indicates negation (all characters except following)
* indicates 0 or more repetitions of next thing (yeah, I
reversed it... seems easier to read though)
+ indicates 1 or more repetitions of next thing
Has anyone with 3.0 seen anything different from this?
Anybody from ISI care to comment on how stable this is likely to be?
(Yeah, I know, it's stable till it changes...)
Raul Rockwell