Re: [Jprogramming] Advent of Code day 2 + comment on day 18

2021-12-22 Thread Skip Cave
Here's my AoC Day 2 solution: https://adventofcode.com/2021/day/2 this problem seemed perfect for running sums (+/\) n=.'b' freads 'depth2.txt' NB. Read in File a=.'forward';'up';'down' s=.;".ea{:ea n NB. Get numeric values (ea = each) t=.+./@E.&.> NB. string match mark each. m=.s*"1[1 _1 1*>((0{

Re: [Jprogramming] Advent of Code day 2 + comment on day 18

2021-12-22 Thread 'Michael Day' via Programming
Thanks, Raul I've checked what "use" does with an example.  I won't study its details,  though,  not wanting to crib.  I will say though that the output is similar to my interim results in processing the data. My mistake appears to have been to keep the verbose format and try to reproduce it, 

[Jprogramming] Please view Discussion Page of: (nuVoc) Vocabulary/hook

2021-12-22 Thread Ian Clark
Re: [Jprogramming] Modifier train tutorial (was: "fix" new trains) … I have opened the Discussion page of: https://code.jsoftware.com/wiki/Vocabulary/fork …in which I have proposed a change to the structure of the said page. I'm hoping MediaWiki picks up on this and notifies the other Jwikipedian

Re: [Jprogramming] Advent of Code day 2 + comment on day 18

2021-12-22 Thread Raul Miller
Nope, ignore that simplification -- there was a reason I did it the other way. Sorry about the noise. -- Raul On Wed, Dec 22, 2021 at 4:30 PM Raul Miller wrote: > > Actually, looking at this, I am already seeing a simplification I > could have made: > > use=: {{ >depth=. +/\-/'[]'=/y >

Re: [Jprogramming] Advent of Code day 2 + comment on day 18

2021-12-22 Thread Raul Miller
Actually, looking at this, I am already seeing a simplification I could have made: use=: {{ depth=. +/\-/'[]'=/y sel=. _1|.0 1 E.{~mask=.-.y e. '[,]' vals=.".mask #inv mask#y assert. (+/sel)=#vals (sel#depth),:vals }} -- Raul On Wed, Dec 22, 2021 at 4:27 PM Raul Miller wrote: >

Re: [Jprogramming] Advent of Code day 2 + comment on day 18

2021-12-22 Thread Raul Miller
My plan is to post about aoc18 in another 16 days (I am planning on spacing these posts out, one per day -- basically lagging the original puzzles each by 20 days). That said, I didn't use much boxing for aoc18. Maybe if I show the line parsing routine, that I used, it will give you a hint? use=:

Re: [Jprogramming] Advent of Code day 2 + comment on day 18

2021-12-22 Thread 'Michael Day' via Programming
Apologies - more chat than programming,  but: fwiw,  for part 1,  I just defined simple one-liner functions "forward" etc which worked ok.  For part 2, they needed redefining,  and, yes, I used direct defs;  nothing as sophisticated as fold! I've done days 1-17,  mostly straightforward,  some v

Re: [Jprogramming] Advent of Code day 2

2021-12-22 Thread Raul Miller
(responding to http://jsoftware.com/pipermail/programming/2021-December/059436.html#) I am not sure that I thought this example out well enough for it to be good on an examples page. For instance, after thinking about it for just a few minutes, I realized that b2fold=: 0 0 0&(}.F..{{ 'dH0 dA0

Re: [Jprogramming] Tacit completeness

2021-12-22 Thread 'Pascal Jasmin' via Programming
This seems to work as a general approach? nn =. 1 : 'x u y' The new-old trains cover pretty completely your use scenarios ACC CCA VCC CCV VCA ACV 5 ([ 2 : 'u+v' -nn + ]) 3 10 5 ([ 2 : 'u+v' -@]nn + ]) 3 5 or with my compound modifier train framework 5 [ +F1 -nn +F ] 3 10 On Tuesday, De

Re: [Jprogramming] Advent of Code day 2

2021-12-22 Thread Henry Rich
I didn't follow this in detail, but I do know that more examples are needed, and hope you will add this one to the NuVoc page, or hive it off to a new FoldExamples page.  The pattern you end up with looks generally useful. Henry Rich On 12/22/2021 9:08 AM, Raul Miller wrote: previous message

[Jprogramming] Advent of Code day 2

2021-12-22 Thread Raul Miller
previous message: http://jsoftware.com/pipermail/chat/2021-December/009000.html AoC day 2 details: https://adventofcode.com/2021/day/2 For day 2, we were "piloting a submarine" given a sequence of steering instructions, My approach was to convert those directions to numeric form: normalize=: _&"