Dan writes:
"
Pepe wrote:
> 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 ;)
Ohhhh, you almost had me, Pepe. You almost had me.
*continues on quest for Holy Grail*
"
Against my best judgement :), a purist version of Adv follows,
o=. @:
e=. &.>
ar=. 5!:1@:<
(a0=. `'') (a1=. (@:[) ((<'&')`) (`:6)) (a2=. (`(<(":0);_)) (`:6))
((`'')(((@:[)(&`))(`:6)))((`_)(`:6))
av=. ((ar'a0')`) (`(ar'a1')) (`(ar'a2') ) (`:6)
NB. Adverbing a monadic verb (adv)
assert 1 4 9 -: 1 2 3 *: av
aw=. < o ((0;1;0)&{::) NB. Fetching the atomic representation
a3=. (o (aw f.)) ('av'f.)
a4=. "_
a5=. `:6
a6=. ((( ar'a4') ; ] ; ( ar'a3')"_) ('av'f.)) (`:6)
Adv=. `((ar'a6')`(ar'a5')) (`:6)
assert 1 4 9 -: 1 2 3 ((<'*:') ; ] ) Adv
assert 6 -: * (< , ((<'/')"_)) Adv 1 2 3
assert 0 1 3 -: (*:`(+/\)) (0&{ , (<'-') , 1&{)@:(('';1)&{::) Adv 1 2 3
_66 ]\ (5!:5)@<'Adv'
(`((((`'')(&(((<(<,'4'),<(<,'"'),<(,'0');_) ; ] ; (<(<,'4'),<(<(<,
'4'),<(<,'o'),<(<'@:'),<(<,'<'),<(<,'&'),<(<(<,'0'),<0;1;0),<'{::'
),<(<,'4'),<(<(<,'4'),<(<(<,'4'),<(<(<,'4'),<(<(<,'0'),<<(<,'4'),<
(<,'`'),<<;._1 ' 0 '),<,'`'),<(<,'4'),<(<,'`'),<(<,'0'),<<(<,'4'),
<(<(<,'4'),<(<(<,'4'),<;:'@:['),<(<,'4'),<(<(<,'0'),<<'&'),<,'`'),
<(<,'4'),<(<'`:'),<(,'0');6),<(<,'4'),<(<,'`'),<(<,'0'),<<(<,'4'),
<(<(<,'4'),<(<,'`'),<(<,'0'),<<(,'0');_),<(<,'4'),<(<'`:'),<(,'0')
;6),<(<,'4'),<(<'`:'),<(,'0');6)"_)@:[)))((`_)(`:6)))(`:6)`(`:6)))
(`:6)
Playing dirty is so much more fun!
assert 1 4 9 -: 1 2 3 *: adv
assert 6 -: * (,^:(0:`(<'/'))) adv 1 2 3
assert 0 1 3 -: (*:`(+/\)) (train f. o (0&{ , (<'-') , 1&{)) adv 1 2 3
On Tue, Dec 15, 2015 at 11:32 AM, Dan Bron <[email protected]> wrote:
> Raul wrote (in the original thread):
> > Like this?
> >
> > cam=:2 :0
> > u 5!:1<'v’
> > )
> >
> > Am=:1 :0
> > u cam
> > )
>
> Well …
>
> I wrote:
>
> > - It is tacit
>
> Not having it tacit defeats the purpose of the exercise: extending our
> tacit adverbial programming toolkit, so more J programs can be expressed
> more easily in F^4, or Fully Fixed Functional Form.
>
> Now, that’s not a sport everyone enjoys, but it is the one we are playing.
>
> Pepe wrote:
> > 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 ;)
>
> Ohhhh, you almost had me, Pepe. You almost had me.
> *continues on quest for Holy Grail*
>
> -Dan
>
>
> PS: A more detailed description of what I’m looking for was given in a
> 2013 thread [1]:
>
> > Exercise for the very ambitious reader: define a tacit adverb opTheat
> > (operating theatre), which, given a verb (the surgeon), derives another
> > tacit adverb, such that
> >
> > surgeon opTheat
> > ((<":0)`) (surgeon`) (@.(0; 1 2))
> >
> > The objective is to be able to provide an convenient utility / interface
> for
> > adverbial programmers, so that their responsibility is only to write the
> > core a.r.-transforming function (i.e. perform the surgery), and not
> always
> > have to prepare the patient and the operating theatre themselves.
> >
> > Note that excessive quoting will somewhat defeat the purpose of the
> exercise
> > (defining the adverb _tacitly_; it's easy to do explicitly, exactly
> because
> > that's just quoted code).
>
> [1]: J Programming, "making a 'first' adverb tacit”:
>
> http://www.jsoftware.com/pipermail/programming/2013-November/033914.html <
> http://www.jsoftware.com/pipermail/programming/2013-November/033914.html>
>
>
>
>
> > On Dec 14, 2015, at 11:30 PM, Raul Miller <[email protected]> wrote:
> >
> > Like this?
> >
> > cam=:2 :0
> > u 5!:1<'v'
> > )
> >
> > Am=:1 :0
> > u cam
> > )
> >
> > Or, of course, you could squash the pieces together, which might be a
> > good thing if you are working in a more hostile environment.
> >
> > Am2=: 1 :0
> > u 2 :'u 5!:1<''v'''
> > )
> >
> > Thanks,
> >
> > --
> > Raul
> >
> >
> > On Mon, Dec 14, 2015 at 4:34 PM, Dan Bron <[email protected]> wrote:
> >> For the sake of clarity:
> >>
> >> - The general adverb is named “Am”.
> >> - It is tacit
> >> - Its input is a verb, say “f"
> >> - Its output is a (derived, tacit) adverb, named “Dam”
> >> - Dam consumes either verbs or nouns; call this argument “u”
> >> - Whether a verb or noun, Dam converts its argument, u, whether noun
> or verb, into its own atomic representation
> >> - After converting u to an atomic representation, Dam calls f with the
> argument (now a noun by definition) u
> >> - The verb f produces a new atomic representation (via manipulation of
> u)
> >> - This new atomic representation is the result (output) of Dam
> >>
> >> In re: converting the atomic rep back into a verb: I can handle that
> myself; there may be multiple layers / applications of Am, so I’d prefer
> the result to be an a.r. which I’ll `:6 at the very end. Note that the
> resultant a.r. may represent something other than a verb: another adverb,
> for example, or a conjunction or a noun, etc.
> >>
> >> -Dan
> >>
> >>
> >>> On Dec 14, 2015, at 3:52 PM, Raul Miller <[email protected]>
> wrote:
> >>>
> >>> On Mon, Dec 14, 2015 at 10:58 AM, Dan Bron <[email protected]> wrote:
> >>>> 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
> >>>
> >>> So your "general adverb" would map a verb into an adverb which
> >>> consumes verbs and produces atomic reps? Or did you intend an
> >>> additional step there, which translates an atomic rep back to a verb?
> >>>
> >>> --
> >>> Raul
> >>> ----------------------------------------------------------------------
> >>> 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
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm