I feel that you are off in the weeds. But you are so seldom there,
maybe I just don't understand.
AR is not a native JE rep. It's there for portability. Converting an AR
to LR is nothing you would ever see in the JE. Thus I think your work on
a J model is misdirected.
Moreover, you will never feed it an AR of ((,'0');'{{'). {{ is a
spelling error. It will never get into the parser and will never be
part of a verb.
Furthermore, {{ is not a noun. It is a control word. Its AR would be
(<'{{').
Nested DDs are represented as (9 : 'string'). [This is internal and
subject to change.] The LR for this is already converted to a DD:
a =. 3 : 0
b =. {{ x + y }}
b y
)
5!:5 <'a'
3 : 0
b =. {{ x + y }}
b y
)
Where the new LR class is needed is in the display of the outermost
definition. You want the LR of A to be
{{
b =. {{ x + y }}
b y
}}
I think this is a fairly small change to the LR code. A deeper question
is whether the resulting string, when executed, will reproduce the
desired value. That is an issue to be resolved during the beta.
Henry Rich
On 10/28/2020 6:54 PM, Raul Miller wrote:
Right -- I was talking about the mechanism that would be used to do that.
The linear representation code at
https://www.jsoftware.com/ioj/iojRep.htm works by taking an atomic
representation and converting it into a linear representation.
In other words, the linear representation of {{+/y}} is 3 : '+/y'
More specifically, to generate
3 : '+/y'
that linear representation code starts from this data structure
{{+/y}} arep
+---------------------+
|+-+-----------------+|
||:|+-----+---------+||
|| ||+-+-+|+-+-----+|||
|| |||0|3|||0|+ / y||||
|| ||+-+-+|+-+-----+|||
|| |+-----+---------+||
|+-+-----------------+|
+---------------------+
What I was saying is that I could use that same code, with relatively
minor modifications, if I were to feed it something that looked like
this:
+-----------------------------+
|+-+-------------------------+|
||:|+------+---------+------+||
|| ||+-+--+|+-+-----+|+-+--+|||
|| |||0|{{|||0|+ / y|||0|}}||||
|| ||+-+--+|+-+-----+|+-+--+|||
|| |+------+---------+------+||
|+-+-------------------------+|
+-----------------------------+
But this doesn't deal with the occasional need for decorators like )a
-- that gets into deeper waters.
That said, maybe as proof of concept I should start with an
implementation which includes those decorators on multi-line
definitions and leaves them off of single line definitions? (Since the
decorators themselves currently require a newline to separate them
from the first line of code).
Note also that what I am saying means that this implementation would
NOT deal with the improper use of bare reserved argument names in the
resulting code, for single line definitions. But since that's a
relatively minor problem, maybe it's the right approach?
Thanks,
--
Raul
On Wed, Oct 28, 2020 at 8:46 AM Henry Rich <[email protected]> wrote:
You don't want to touch the internal representation (which is different
from AR). What is produced by {{ }} is just an explicit definition.
What you want is a switch to display an explicit definition using {{ }}
rather than n : 0. That could be as simple as using {{)x }} .
A different decision is whether you want to remember how a verb was
created, and display it in that form.
Henry Rich
On 10/27/2020 11:02 PM, Raul Miller wrote:
Hmm... actually, this might mean something new -- this approach
suggests delving into the atomic rep, finding the explicit definitions
and converting them to dd.
But that implies a less explicit ar which can directly represent a
direct definition. So, for example, making a '{{' token which has a
modifier indicating type (for example )a or )v or whatever), followed
by the direct definition text. Probably followed by an inert '}}'
token to make the ddrep implementation simpler...
I would definitely want Eric to weigh in on a design change that hits
the system this deeply.
Thanks,
--
This email has been checked for viruses by AVG.
https://www.avg.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm