Re: [Jprogramming] Questions on day 13 of Advent of Code 2022

2022-12-14 Thread Raul Miller
I should add: On Wed, Dec 14, 2022 at 4:19 PM I wrote: ... > Here, OP was a gerund such that OP@.0 represented what monkey 0 would > do to the "worry levels", OP@.1 represented monkey 1, and so on. Note that a better representation here would interpret each monkey's operation as a polynomial

Re: [Jprogramming] Questions on day 13 of Advent of Code 2022

2022-12-14 Thread Raul Miller
On Wed, Dec 14, 2022 at 3:49 PM Jaume wrote: > The first days I tried, now I have less time and the problems are harder. That does happen. I expect aoc day 24 to take me a few days to solve (unless it happens to be a problem I somehow have already put a lot of thought into). > I have to say

Re: [Jprogramming] Questions on day 13 of Advent of Code 2022

2022-12-14 Thread Jaume
Missatge de Raul Miller del dia dc., 14 de des. 2022 a les 18:33: > On Wed, Dec 14, 2022 at 2:26 AM Jaume wrote: > > Because somewhere in there something broke and on the phone I have the > > wrong answer for part 1. > > Yes... generally it's easier to debug if you have a much smaller >

Re: [Jprogramming] Questions on day 13 of Advent of Code 2022

2022-12-14 Thread 'Mike Day' via Programming
Well done! Day 13 has been unlucky for me; still floundering around, not even managing to solve the example. Anyway, I also always try to solve the example first, if I can. One, perhaps two, of the earlier problems did have a feature that didn't appear in the example, though. The

Re: [Jprogramming] Questions on day 13 of Advent of Code 2022

2022-12-14 Thread Raul Miller
On Wed, Dec 14, 2022 at 2:26 AM Jaume wrote: > Because somewhere in there something broke and on the phone I have the > wrong answer for part 1. Yes... generally it's easier to debug if you have a much smaller implementation. It's also a *lot* easier if you write your code so that you can test

Re: [Jprogramming] Questions on day 13 of Advent of Code 2022

2022-12-13 Thread Jaume
Thank you, this was the tip I needed. Last night I managed to get the correct answer on the phone with this. If you want to examine what I have it's on the same place. solution.ijs has the latest I did on the computer, 1.ijs is what I had on the phone. Because somewhere in there something broke

Re: [Jprogramming] Questions on day 13 of Advent of Code 2022

2022-12-13 Thread Raul Miller
Oh, one other thing... For aoc 13 part 2, you do not actually need to sort anything. You can compare the '[[2]]' representation against each value and count how many precede it. Then you can do the same with the other value (adding 1, because it would come after the '[[2]]' value. FYI, --

Re: [Jprogramming] Questions on day 13 of Advent of Code 2022

2022-12-13 Thread Raul Miller
I was not able to decipher the value of pp which you posted here, after the email system mangled it. Also, it looks like your current github code -- https://github.com/JaumeGreen/adventofcode/blob/master/2022/day13/explanation.ijs -- doesn't work for me when I try it on my input.txt from the aoc

Re: [Jprogramming] Questions on day 13 of Advent of Code 2022

2022-12-13 Thread Jaume
Thank you I think it's going better, or at least I'm understanding a bit more. The problem I had was another, quicksort was sending the whole list to compare inside comp2. I fixed it with these: quickp=: 3 : 0 if. 1 >: #y do. y else. (quickp y lesser sel e),(y equal sel e),quickp y greater sel

Re: [Jprogramming] Questions on day 13 of Advent of Code 2022

2022-12-13 Thread Raul Miller
p.s. for the tacit stack issue, you did not include your definition of comp2, but if it's from aoc day 13, a plausible issue is that comp2 would be returning _1 or 1 instead of 0 or 1 (which is what that quicksort implementation expects). That said, when debugging stack errors on recursive

Re: [Jprogramming] Questions on day 13 of Advent of Code 2022

2022-12-13 Thread Raul Miller
It used to be that x was more ambiguous. To make quicksort work, use sel=: 1 : 'u # [' I will update the wiki. Thanks, -- Raul On Tue, Dec 13, 2022 at 1:43 PM Jaume wrote: > > Hello all > > Still here and I've done all the days in J except for day 7, But that's not > why I'm here. > > So

[Jprogramming] Questions on day 13 of Advent of Code 2022

2022-12-13 Thread Jaume
Hello all Still here and I've done all the days in J except for day 7, But that's not why I'm here. So now I've done the first part, and I have a function that is too long to copy that does comparisons in an iterative way (I had some stack problems). Now I'm wanting to sort the elements using