Re: [Jprogramming] Questions on Advent of code Day 5

2022-12-07 Thread 'Pascal Jasmin' via Programming
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

Re: [Jprogramming] Questions on Advent of code Day 5

2022-12-07 Thread Raul Miller
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 str

Re: [Jprogramming] Questions on Advent of code Day 5

2022-12-07 Thread Brian Schott
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

Re: [Jprogramming] Questions on Advent of code Day 5

2022-12-06 Thread 'Pascal Jasmin' via Programming
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 i

Re: [Jprogramming] Questions on Advent of code Day 5

2022-12-06 Thread Brian Schott
Damn. On Tue, Dec 6, 2022 at 6:31 PM Henry Rich wrote: > No, u is the left argument and v is the right. u@v for example. > > Henry Rich > > > -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Questions on Advent of code Day 5

2022-12-06 Thread Henry Rich
No, u is the left argument and v is the right.  u@v for example. Henry Rich On 12/6/2022 6:29 PM, Brian Schott wrote: Raul, I'm beginning to understand your explanation of lfold=: {{ ]F..(u~) }} . You're saying that j conjunctions have a left and right argument we call v and u, respectively (

Re: [Jprogramming] Questions on Advent of code Day 5

2022-12-06 Thread Brian Schott
Raul, I'm beginning to understand your explanation of lfold=: {{ ]F..(u~) }} . You're saying that j conjunctions have a left and right argument we call v and u, respectively (from the perspective of the interpreter). In that context, u is on the right of the conjunction, and that's why you used u

Re: [Jprogramming] Questions on Advent of code Day 5

2022-12-06 Thread Brian Schott
Henry, *Oh!* The grey x and y's were so dim and small, I could not see them. That explains a lot. Thank you. Now, I need to look again at Raul's explanation, which came in after yours. On Tue, Dec 6, 2022 at 5:34 PM Henry Rich wrote: > The initial value (x) and all subsequent results of v go in

Re: [Jprogramming] Questions on Advent of code Day 5

2022-12-06 Thread Raul Miller
Context is important here. In lfold=: {{ ]F..(u~) }} The u for lfold is the v for F.. The J parser is not going to interpret u or v according to some referenced definition -- it's going to interpret u or v according to the definition it's currently interpreting. The same holds for x and y.

Re: [Jprogramming] Questions on Advent of code Day 5

2022-12-06 Thread Henry Rich
The initial value (x) and all subsequent results of v go into the right argument of v. All I'm saying is that the picture is right. Henry Rich On 12/6/2022 5:32 PM, Brian Schott wrote: So, is the picture signalling that v's left argument is y, and v's right argument is x? If so, that's what m

Re: [Jprogramming] Questions on Advent of code Day 5

2022-12-06 Thread Brian Schott
So, is the picture signalling that v's left argument is y, and v's right argument is x? If so, that's what makes no sense, to me. Or are you saying I've got v and u backwards, like I claimed Raul does? On Tue, Dec 6, 2022 at 5:26 PM Henry Rich wrote: > The picture is up to date. > > Henry Rich

Re: [Jprogramming] Questions on Advent of code Day 5

2022-12-06 Thread Henry Rich
The picture is up to date. Henry Rich On 12/6/2022 5:24 PM, Brian Schott wrote: Don't you mean v instead of u. And even so, that may be the backward stuff that was discussed for a while in the early Fold stages? On Tue, Dec 6, 2022 at 5:21 PM Raul Miller wrote: You should probably spend a f

Re: [Jprogramming] Questions on Advent of code Day 5

2022-12-06 Thread Brian Schott
Don't you mean v instead of u. And even so, that may be the backward stuff that was discussed for a while in the early Fold stages? On Tue, Dec 6, 2022 at 5:21 PM Raul Miller wrote: > You should probably spend a few minutes studying the diagram at > > https://code.jsoftware.com/wiki/Vocabulary/f

Re: [Jprogramming] Questions on Advent of code Day 5

2022-12-06 Thread Raul Miller
You should probably spend a few minutes studying the diagram at https://code.jsoftware.com/wiki/Vocabulary/fcap#How_should_I_define_u_and_v.3F The short form, however, might be summarized as: lfold=: {{ ]F..(u~) }} rfold=: {{ ]F.:(u~) }} I hope this makes sense, -- Raul On Tue, Dec 6, 202

Re: [Jprogramming] Questions on Advent of code Day 5

2022-12-06 Thread Brian Schott
Raul, That is extremely helpful. The main thing I get out of both of your solutions, but most clearly out of the insert solution is that the argument to be altered should be on the right side. For some reason, I have wanted to reverse that. But your insert solution demonstrates that strongly. Whe

Re: [Jprogramming] Questions on Advent of code Day 5

2022-12-06 Thread Raul Miller
P.S. I was going to mention, but I forgot: email managed to strip trailing spaces from your message. This caused an error in the phrase 1 5 9&{;._2 top One workaround here is to insert trailing spaces so that that phrase evaluates. Another approach though would be to replace it with 1 5 9{];._2 t

Re: [Jprogramming] Questions on Advent of code Day 5

2022-12-06 Thread Raul Miller
I've not fully digested all of the fold rules yet, so I'll first focus on building an insert version. The key to using insert is building representing the expression which would result from insert. In other words, instead of state tomove moves +-+-++ |C|M|PDNZ| +-+-++ We could look at

[Jprogramming] Questions on Advent of code Day 5

2022-12-06 Thread Brian Schott
I have successfully solved Day 5 using the following looping verb `tomove` but cannot craft a Fold version, and would like help. *[FYI I have included an attachment that seems to load and execute properly, but I could NOT get the email versions to load correctly, presumably because of some funny c