Pepe wrote:
> This is a puzzle for adverbial tacit writing fans: Write a purist tacit
> adverb (sf1) such that, for example,
> 
>   (v0 v1 v2)sf1
> v0@[ v1 v2@]
> 
>   3 4 (+: + -:)sf1   2 4
> 7 10


I’m sure your solution is more elegant, but I haven’t looked yet, so here’s my 
attempt:

        LMR =: (`'') ((<":noun)`) (((":noun) <@:; <^:2)`) (@.(0; 1 2)) (xform`) 
(`:6) (`:6)
          xform =: (left center right)`'' ('[' atop~ ])`(']' atop~ 
])`]@.((;:'left right') i. [)"0 L:1 ]
            atop =: '@' <@; <@:,&boxopen

For example:

        (v0 v1 v2) LMR
     v0@[ v1 v2@]

        3 4 (+: + -:)LMR 2 4
     7 10

The approach is general in the sense that it simply converts the train into its 
atomic representation, then manipulates that representation structurally, then 
executes the manipulated atomic rep to produce the desired verb.

I have yet to find a satisfactory, general, and elegant way to express the 
clause:

        ((<":noun)`) (((":noun) <@:; <^:2)`)  (@.(0; 1 2))

Which is almost-but-not-quite repeated in all the code I’ve written along these 
lines (e.g. in “anonymous evoke”, etc). It converts the atomic rep of (v0 v1 
v2), which is:

        <(":verb) ;< ;:'v0 v1 v2'
     +--------------+
     |+-+----------+|
     ||3|+--+--+--+||
     || ||v0|v1|v2|||
     || |+--+--+--+||
     |+-+----------+|
     +--------------+

to the atomic representation _of that atomic representation_, which is:

        <(":noun) ;<(":verb) ;< ;:'v0 v1 v2'
     +------------------+
     |+-+--------------+|
     ||0|+-+----------+||
     || ||3|+--+--+--+|||
     || || ||v0|v1|v2||||
     || || |+--+--+--+|||
     || |+-+----------+||
     |+-+--------------+|
     +------------------+

Doing this is necessary so that we can then prepend the manipulating verb (in 
this case, xform) to this atomic rep, then execute the resulting gerund (array 
of 2 atomic reps: the verb and the box above), so that the verb acts on the 
atomic rep of the train.

I thought I could do something along the lines of 

      (`'') ((<":noun)`) (xform`) (@.(0;1 2))

That is, just create an array of 3 boxes, then use the boxed-RHA version of @. 
to nest the gerund appropriately, but unfortunately in this case, the input to 
xform needs an extra layer of boxing, and (@.(0;1 ;<2)) etc didn’t work.

What I’d really like is a general adverb that 

   - Accepts a verb as input, deriving another adverb
   - That adverb converts its own input, whether noun or verb, to its atomic 
representation
   - Then the derived adverb applies the original verb to the atomic rep it 
just created, allowing it to produce a new atomic rep

That is, the verb input to this adverb would be an “atomic rep manipulator”; 
having this adverb would make essentially reduce general tacit adverbial 
programming in J to general tacit verb writing, which is a much better explored 
field, and easier to do.

-Dan

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

Reply via email to