Note also here that replacing move with ,&< in the lfold sentences
would construct a sequence of boxes representing the argument pairs
being passed to 'move'

Or you could replace it with ; which might be even more illuminating
(here you would not get pairs from an rfold and instead the nesting
structure would show you where explicit parenthesis would be required
when forming an equivalent command line).

Alternatively, using move&([echo) would give you a somewhat analogous
view (but explicitly showing you intermediate results generated by
'move')

(Generally speaking, when working with J "control words" I like to be
able to "see" some sort of representation of their intermediate
results. My theory is that when I understand concretely how the data
is being "transformed", that helps me better understand abstractly
what the code is doing.)

I hope this helps,

-- 
Raul

On Wed, Dec 7, 2022 at 9:45 AM 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