Dan writes:

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

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

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.
"

I have never really liked the @. way very much but for a while I thought it
was necessary but it is not.  The solution that you did not see uses the
form (workhorse f.av (`:6)) but it is not quite what you have in mind.  In
Jx i have been using for quite some time  an adverb (adv) that is very
close to it; the form to produce an adverb is (darkhorse f.adv) .  So, for
example, ]adv is, of course, the identity adverb.  The Jx version is just a
variant of a new primitive in the latest version of the interpreter but I
just rewrote a draft version of adv for an official J interpreter (it has
been just midly tested)...

   JVERSION
Installer: j602a_win.exe
Engine: j803/2014-10-19-11:11:11
Library: 6.02.023

   (i.2 3) ]adv
0 1 2
3 4 5
   !@#     ]adv
!@#
   u`v     ]adv
┌─┬─┐
│u│v│
└─┴─┘


   !@# <adv  NB. Boxing !@# !
┌───┐
│!@#│
└───┘

An alternative version more acceptable to a purist has the form (workhorse
f.Adv) where the workhorse verb takes the atomic (gerundial?)
representation of the argument,


   (i.2 3) ]Adv
┌─────────┐
│┌─┬─────┐│
││0│0 1 2││
││ │3 4 5││
│└─┴─────┘│
└─────────┘
   !@#     ]Adv
┌─────────┐
│┌─┬─────┐│
││@│┌─┬─┐││
││ ││!│#│││
││ │└─┴─┘││
│└─┴─────┘│
└─────────┘
   u`v     ]Adv
┌─────────┐
│┌─┬─────┐│
││0│┌─┬─┐││
││ ││u│v│││
││ │└─┴─┘││
│└─┴─────┘│
└─────────┘

Both, adv and Adv are tacit, fixed, and @. free,:

   adv
((`'')(&(,^:(0:``:)&6@:((<(,'0');"_) ; ] ; (<(,'0');(@:(,^:(0:``:)&6@
:(<@:((0;1;0)&({::)))))((((`''`)(`(((@:[)(&`))(`:6))))(`((`_)(`:6))))(`:6)))"_)@:[)))((`_)(`:6))
   Adv
((`'')(&(,^:(0:``:)&6@:((<(,'0');"_) ; ] ;
(<(,'0');(@:(<@:((0;1;0)&({::))))((((`''`)(`(((@:[)(&`))(`:6))))(`((`_)(`:6))))(`:6)))"_)@:[)))((`_)(`:6))


Later I would try to add more tools and provide some examples but in the
meantime you can play with the toolkit if you like.

NB.
----------------------------------------------------------------------------
NB. Wicked Tacit Toolkit...
NB.
----------------------------------------------------------------------------

NB. Load it using 0!:0 or similar or
NB. paste it on an J editing window and use Crtl-A Crtl-E or
NB. of course, load it using a hot key or ...

o=. @:
e=. &.>

an=.  <@:((,'0') ,&< ])
Cloak=. (<(<,'4'),<(<(<,'4'),<;:'0:`'),<(<,'4'),<;:',^:') (0:`)(,^:)

'evoke fix tie'=. Cloak o < e o ;: '`: f. `'
train=. evoke&6 f.

af=. an o fix

(a0=. `'') (a1=. (@:[) ((<'&')`) (`:6)) (a2=. (`(<(":0);_)) (`:6))
av=. ((af'a0')`)  (`(af'a1')) (`(af'a2') ) (`:6)
  NB. Adverbing a monadic verb (adv)
  assert 1 4 9 -: 1 2 3 *: adv

aw=. < o ((0;1;0)&{::)  NB. Fetching the atomic representation

a3=. (o (train o aw f.)) ('av'f.)
a4=. "_

adv=. train o ((af'a4') ; ] ; (af'a3')"_) f.av

a3=. (o (aw f.)) ('av'f.)
Adv=. train o ((af'a4') ; ] ; (af'a3')"_) f.av

PS.  The adverb adv is intrinsically and proudly wicked; the writing a
purist version of Adv is left as an easy exercise for the reader ;)




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.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to