On Mon, Sep 16, 2019 at 11:57 AM Henry Rich <[email protected]> wrote:
> Maybe they're not logically disjoint, but an input symbol must choose a
> row of the state machine, and you need different rows for 0 and 1.
> Character 0 must not map to the 'hexdigits' input class.

Must it? Or would J just take the first character class with a match?

I went to test this idea, and the first thing I discovered was that
the dictionary example at
https://www.jsoftware.com/help/dictionary/d332.htm no longer works.

It throws a length error when constructing mj (which is the data
structure I was planning on replacing to test this idea against the
implementation).

Anyways, I built a modified version of that code, using:

   Mr=: ('NB'-.~a.{~(a.i.'Aa')+/i.26);' ',TAB
   Mr=: '''';':';'.';'0123456789_';'B';'N';Mr
   M=:(a.-.;Mr);,&.>|.Mr

   x=: 0;sj;<M

And that worked just fine.

And then I inserted an NB into the numeric sequence, and that also
worked just fine.

So then I studied the documentation on that page for confirmation of
this mechanism, and sure enough:

"m is a list of the input mapping; each box of m contains the items of
y that are mapped to the same index. That is, the mapped input is my=.
(y i.~;m) ..."

In other words, when we're working with a sequence of boxed characters
to specify character classes, we have only cared about the box which
contains the first instance of any character.

(The dictionary says 'items' rather than 'characters' but I cannot get
any non-character sequential machine to work today. I have a vague
memory that they used to work, but even my memory is suspect.)

Thanks,


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

Reply via email to