On Sun, Oct 6, 2019 at 10:31 PM 'B. Wilson' via Programming
<[email protected]> wrote:
> Thank you for the confirmation.
>
> So in these two cases, word splitting happens exactly the same
> if we use em() instead, correct? Is there a particular reason to
> *not* use em() though? As far as I can tell, the main difference
> would be in the traces. I would really like to know if ev() was
> chosen here with some specific intention.
>
> Wildly speculating, ...

Speculation is actually relevant here. Speculation implemented in the
state machine.

What we've got is a state machine implementation with a one level deep
stack. This is not enough to handle parenthesis (which can be nested
to an arbitrary depth), but is enough to recognize when a numeric list
ends:

It ends on whitespace when the next numeric word ends with a :

It ends on whitespace when the next word begins with a
non-alphanumeric-word-forming character.

It ends with a non-alphanumeric-word-forming character otherwise.

Hypothetically speaking, this could have been deferred to "the
parser", but that would have made that parser more complicated.

But, also, J has several parsers. There's the sentence parser
mentioned at https://www.jsoftware.com/help/dictionary/dicte.htm

There's also the numeric parser mentioned at
https://www.jsoftware.com/help/dictionary/dcons.htm (which parses at
the character level, in a simplistic fashion).

There's also the wd parser mentioned at
https://www.jsoftware.com/docs/help602/user/wd_commands.htm (which
seems to have its own state machine - though not one which is exposed
as a part of the core language).

And, generally speaking, working with textual data often involves
building parsers...

Thanks,

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

Reply via email to