Newsgroups: comp.lang.apl
Path: watmath!watserv1!utgpu!news-server.csri.toronto.edu!torsqnt!jtsv16!blister!itcyyz!yrloc!hui
From: hui@yrloc.ipsa.reuter.COM (Roger Hui)
Subject: Re: Rank 0 catenation.
Message-ID: <1991Jun27.052421.809@yrloc.ipsa.reuter.COM>
Organization: Iverson Software Inc.
References: <1991Jun24.161151.12366@watmath.waterloo.edu> <ROCKWELL.91Jun24202553@socrates.umd.edu> <ROCKWELL.91Jun24223131@socrates.umd.edu> <WEG.91Jun25125303@convx1.convx1.ccit.arizona.edu>
Date: Thu, 27 Jun 91 05:24:21 GMT

In article <WEG.91Jun25125303@convx1.convx1.ccit.arizona.edu> weg@convx1.ccit.arizona.edu (Eythan Weg) writes:

>    [stuff]
>
> Any time I start playing with this toy I find new ways to recombine
> its constituents.  Is it the language equivalent to Lego?  I am
> confident that this is a common experience.  But here is a point that
> puzzles me.  I wish J to possess a regular expression automaton to be
> used in much the same way as it is used in unix utilities.  Is there
> anything wrong with this desire?  I thought it might be used with E.
> for example.

a) It is not so unusual that the same nontrivial idea can be expressed
in more than one way.  One can say "to be or not to be" or "what now?"
as appropriate; does that make English a Lego language? :-)
 
b) If the regular expression automaton in UNIX is to your liking,
you can invoke it from within J by 0!:0 or by using LinkJ.
 
I have some epsilon-baked ideas on how a FSM can be introduced.
A gerund is an array of atomic representations of verbs.
The conjunction ` returns gerund results, for example, +`-`*`(+/)
is a 4-element gerund; and the conjunction g`:n defined various
verbs from a gerund.  (See Bernecky & Hui, APL91.)
 
If g is a gerund matrix, one can define:  fsm =. g`:57
fsm is applied to successive elements of an integer vector of inputs.
The initial state is 0.  If the current state is i and the current input
is j, then the verb represented by  (<i;j){g  is applied to i and j,
resulting in the pair (newstate;output).  The result of fsm is the
collection of the outputs.

-----------------------------------------------------------------
Roger Hui
Iverson Software Inc., 33 Major Street, Toronto, Ontario  M5S 2K9
(416) 925 6096

