Re: [Jprogramming] Advent of Code Day 12

2022-01-16 Thread P Padilcdx
Ah that makes sense. Thank you! Slowly getting it… Appreciate all the help and patience. > On Jan 16, 2022, at 8:58 PM, Hauke Rehr wrote: > > No, u&v works differently: > > a silly example: > - 4 > _4 > - 5 > _5 > NB. these all do the same: > _4 + _5 > _9 > (- 4) + (- 5) > _9 > 4 +&

Re: [Jprogramming] Advent of Code Day 12

2022-01-16 Thread Hauke Rehr
No, u&v works differently: a silly example: - 4 _4 - 5 _5 NB. these all do the same: _4 + _5 _9 (- 4) + (- 5) _9 4 +&- 5 _9 So dyadic x u&v y applies v monadicly to both x and y, u then applies dyadicly to (v x) and (v y) x u&v y ←→ (v x) u (v y) eg pythagoras %: 3 +&*: 4

Re: [Jprogramming] Advent of Code Day 12

2022-01-16 Thread P Padilcdx
What I don’t quite understand was the expansion of -.&;:&’-‘ y to y (-.&;:) ‘-‘ and then (;: y) -. (;: ‘-‘) So I was thinking the -.&;: is a hook. Complete newbie, so apologies. > On Jan 16, 2022, at 8:46 PM, Hauke Rehr wrote: > > I don’t quite understand. > LHS is just the result of applyi

Re: [Jprogramming] Advent of Code Day 12

2022-01-16 Thread Hauke Rehr
I don’t quite understand. LHS is just the result of applying ;: to the value 'start-A'. Am 17.01.22 um 05:45 schrieb P Padilcdx: That helps. What rule applies for making the LHS? Is it a hook? Thank You!! On Jan 16, 2022, at 8:09 PM, Hauke Rehr wrote: Maybe I should elaborate on this a bit

Re: [Jprogramming] Advent of Code Day 12

2022-01-16 Thread P Padilcdx
That helps. What rule applies for making the LHS? Is it a hook? Thank You!! > On Jan 16, 2022, at 8:09 PM, Hauke Rehr wrote: > > Maybe I should elaborate on this a bit more: > > ] LHS =: ;: 'start-A' > ┌─┬─┬─┐ > │start│-│A│ > └─┴─┴─┘ > ] RHS =: ;: '-' > ┌─┐ > │-│ > └─┘ > LHS -. RHS

Re: [Jprogramming] Advent of Code Day 12

2022-01-16 Thread Hauke Rehr
Maybe I should elaborate on this a bit more: ] LHS =: ;: 'start-A' ┌─┬─┬─┐ │start│-│A│ └─┴─┴─┘ ] RHS =: ;: '-' ┌─┐ │-│ └─┘ LHS -. RHS ┌─┬─┐ │start│A│ └─┴─┘ (;: 'start-A') -. (;: '-') ┌─┬─┐ │start│A│ └─┴─┘ Or was the missing link for you somewhere else? Am 17.01.

Re: [Jprogramming] Advent of Code Day 12

2022-01-16 Thread Hauke Rehr
First, you apply ;._2 Then it’s just a row-wise -.&;: eg 'start-A' (-.&;:) '-' ┌─┬─┐ │start│A│ └─┴─┘ Am 17.01.22 um 04:01 schrieb P Padilcdx: Slowly following the discussion. I confess I’m stuck at how the composition of -.&;:&’-‘ work in the unpack verb. Try to read the descripti

Re: [Jprogramming] Advent of Code Day 12

2022-01-16 Thread P Padilcdx
Slowly following the discussion. I confess I’m stuck at how the composition of -.&;:&’-‘ work in the unpack verb. Try to read the description of & in NuVoc and LJ, but i confess to still be clueless as to how J parses it. I experimented a bit but still perplexed. Can someone point me in the ri

Re: [Jprogramming] Advent of Code Day 25

2022-01-16 Thread 'Michael Day' via Programming
Also pretty crude,  in one self-contained routine,  "move" . It was fast and slim enough for its purpose!    $data 137 139    ts'move data' 0.0623268 1.69075e6    timer'move data' +-+---+ |0.0669937|412| +-+---+ move =: 3 : 0 NB. long-winded but never mind _ move y  N

Re: [Jprogramming] Advent of Code Day 24

2022-01-16 Thread Raul Miller
On Sun, Jan 16, 2022 at 12:34 PM 'Michael Day' via Programming wrote: > OK - your approach is far more efficient than mine! I suspect you did > what I had in mind, but couldn't quite get that mind to produce. I should perhaps add.. My first (reverse) pass through the possibilities did not conce

Re: [Jprogramming] Advent of Code Day 24

2022-01-16 Thread Raul Miller
On Sun, Jan 16, 2022 at 12:34 PM 'Michael Day' via Programming wrote: > I see that you (Raul) didn't bother with truncating divide towards > zero. In testing, I fell foul of this, > and used > divt =: {{ s * y <.@%~ | x [ s =. * x }} > ... but I think you're ok in the actual "program" as d

Re: [Jprogramming] Advent of Code Day 24

2022-01-16 Thread 'Michael Day' via Programming
OK - your approach is far more efficient than mine!  I suspect you did what I had in mind, but couldn't quite get that mind to produce. I see that you (Raul) didn't bother with truncating divide towards zero.  In testing,  I fell foul of this, and used    divt =: {{ s * y <.@%~ | x   [ s =. *