All programming languages can have their function definitions understood as a 
template where "parameter variables" get substituted with their parameter 
values when called.

in J, explicit verbs have x and y parameter variables, while tacit or built-in 
verbs can/are documented as if x and y were explicitly included.

The identity adverb:  1 :'u' (new in 9.04 ]:) where u is a verb is identical to

1 : 0
u y
:
x u y
)

  
An adverb just has 1 "core" parameter: u.  A conjunction has 2: u and v.

The long version of the identity adverb template above has additional explicit 
verb arguments, as a single template.  The short version can be understood as 
returning a new template, but with implicit parameters that make a template 
unneeded (because the template is just implied) 

"And since Raul defined his explicitly, he was required to use `u` instead of 
`v`"


I'd word that as Raul defined an adverb.  The only template variable in an 
adverb definition is `u`

Every conjunction C has an implied template equivalent to the explicit:  2 : 'u 
C v'

other equivalencies are:
u(C v)
v(u C)

binding one parameter with a Conjunction results in an adverb that only 
requires one more parameter to "fully bind original conjunction"

Raul's lfold definition is equivalent to

1 : '] {{u F.. v}} (u~)'

the "internal expansion" of F.. is not visible to the (external) adverb 
definition.  Once u is provided though, (u~) will be inserted into F.. 's 
template as it's v parameter.  F.. 's u parameter is fixed as ]

My tacit version has explicit equivalent of

1 : 'u~(] {{u F.. v}}) '

] is still fixed as u to F.. making that fixing an adverb
the ~ adverb will modify u before forwarding the result to the above adverb.
template substitution of u in the adverb definition will complete the v 
(internal template) parameter to F.. and complete the binding of F..
Fully bound F.. becomes a verb with implied y and possibly x template 
parameters.


On Wednesday, December 7, 2022 at 09:45:45 a.m. EST, Brian Schott 
<schott.br...@gmail.com> wrote: 





Pascal,

The most important thing I learned/remembered from your reply is that your
lfold is an adverb (that happens to be constructed from a pair of adverbs
in an adverb train).
That helped me understand that Raul's lfold is an adverb, too, but defined
explicitly, where yours is defined implicitly.
And since Raul defined his explicitly, he was required to use `u` instead
of `v` . So that registers for me.
Right?

So let's (re)name the adverbs as follows.
And the mock session excerpt below is meant to demonstrate that they
produce the same result.

lfoldR =: {{ ]F..(u~) }}
lfoldP =: ~(] F..)  NB. Adverb train

NB. (It's a little odd that `~` appears on the right
NB. of u in Raul's fold, but as the left adverb in
NB. your adverb train. But that works for me.)

lfoldP =: ~(] F..)
state move lfoldP moves
NB. ┌─┬─┬────┐
NB. │C│M│PDNZ│
NB. └─┴─┴────┘
lfoldR=: {{ ]F..(u~) }}
state move lfoldR moves
NB. ┌─┬─┬────┐
NB. │C│M│PDNZ│
NB. └─┴─┴────┘

*Many thanks to you and to Raul and Henry*,


On Tue, Dec 6, 2022 at 7:56 PM 'Pascal Jasmin' via Programming <
programm...@jsoftware.com> wrote:

> To clarify,
>
> A conjunction F.. in this case, is documented according to the same
> explicit defintion:  either 2 : 'u F.. v' or {{u F.. v}}
>
> In the above explicit definitions u is left argument to F..  v is right
> argument.
>
> lfold is an adverb. Has just one left argument u.  That adverb will place
> its u argument in "the v position" of F..
>
> a tacit versions of lfold
>
> lfold =: ~(] F..)  NB. Adverb train
>
> for easier display
>
> - ~(+: @:)
>
> +:@:(-~)
>
>  2 - ~(+: @:)3
>
> 2
>
>  +: 2 -~ 3
>
> 2
>
>
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to