Lest my messages are taken as idle pun-ditry and Raul decides I need a puns
in the face, let me try to add some value.

I wrote:
>       knockOut =:  ("_) (`'')
>       strip    =:  ((<":noun)`) (({.@>@{:)`) (@.(0; 1 2))  
>       prep     =:  knockOut strip

Raul responded:
> And, of course, with these definitions:
>
>    strip
> |domain error
>
> I'm not sure I can take this much puns.

I take, from Raul's message, that he was inspecting 'strip', most likely to
see how it works.  Let me try to shed some light.

The adverb 'strip' takes an atomic representation as input, and produces
another, related a.r. as output.  Specifically, it strips out the "_
inevitably added in "knockOut", leaving the unadulterated a.r. of the
original input.

It achieves this by creating an intermediate a.r., which is explicitly
marked as a noun, tacking the a.r. of a specific verb in front of it (the
one that will strip off the "_) and executing that verb-noun bident,
invoking the "monad" parser rule, and causing the verb to be applied to the
noun. 

After that, the concepts are straightforward J.  The verb's input is the
a.r. of a noun, which is simply a boxed structure. Because we've normalized
the input, that boxed structure will always have the form '"';< something
;<'0';_  (which is how something"_ is represented as an a.r.). So, the verb
simply traverses the boxed structure, and pulls out the 'something' (i.e.
drops the "_). 

Since a.r.s are recursive, and we pulled 'something' out of an a.r., then
it, too, is an a.r. .  Specifically, 'something' is the a.r. of the original
input, be it a noun or a verb.  QED.

Procedurally, the adverb breaks down into the following steps, in order:
 (0) input

 (1) ("_)  : convert nouns and verbs to verbs of infinite rank.

 (2) (`'') : generate a.r. of (1), which has a little more 
     structure than (0), but the a.r. of (0) necessarily appears
     in the a.r. of (1) 

 (3) ((<":noun)`): tack (<,'0') onto the result of (2), creating
     a 2-element gerund

 (4) (({.@>@{:)`): tack a de-ornamentation verb onto the result 
     of (3), creating a 3-element gerund

 (5) (@.(0; 1 2)): execute the 3-element gerund as V NI where V
     is the verb tacked on in (4), and NI is the atomic composition
     of (2) and (3); that is, the a.r. produced in (2), marked up
     with (3) to say "treat me [NI] as a noun, so when I'm executed, 
     produce identically (2), rather than the object it represents
     (which, of course, is (1))".

The only real trick here, besides 'knockOut', is the RHA to @. , which
isolates and composes N (i.e. ":0, the noun marker) with I (the a.r. of
input"_), producing NI, the a.r. of the a.r. of input"_ . That is,
V`N`I@.(0; 1 2) produces V,<N,I or V,NI and executes it as a train: v ni
(where V is the a.r. of v and NI is the a.r. of ni ).

-Dan


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

Reply via email to