« first day (2503 days earlier)      last day (369 days later) » 

06:34
I did today's using stencil
 
3 hours later…
 
5 hours later…
14:31
-1
Q: Filter a list of list based on data

Yannick GuernI'm pretty new in APL(Dyalog), I'm trying it for the Advent of Code, so I've 1 day of experience ^^ I've this data x ← ((1 'data1') (0 'data2') (0 'data3') (1 'data4') ) x ┌─────────┬─────────┬─────────┬─────────┐ │┌─┬─────┐│┌─┬─────┐│┌─┬─────┐│┌─┬─────┐│ ││1│data1│││0│data2│││0│data3...

Ven
Ven
15:02
@LdBeth Ah, I was considering stencil too, but I need to figure out how to select the numbers first...
15:28
@YannickGuern Welcome. Feel free to introduce yourself or just lurk. We're a friendly bunch here.
15:52
Spent way too long trying to solve today's puzzle without remembering exists
Hello everyone ^^
My name is Yannick, I'm a french guy who love to try new concepts languages and so on
I'm actually doing the Advent of Code in Dyalog-APL, just to try ^^
As the first question ask for parsing. I'm building righ now a parser combinator to help me to beat the first day :D
0
Q: Apply a list of functions on the same right operand

Yannick GuernI have 3 functions which return parse_apple 1 'bpple4578' ┌─┬─────────┐ │0│bpple4578│ └─┴─────────┘ parse_bpple 1 'bpple4578' ┌─┬────┐ │1│4578│ └─┴────┘ parse_45 1 'bpple4578' ┌─┬─────────┐ │0│bpple4578│ └─┴─────────┘ I would like to apply this list of functions on 'bpple4578' And return as so...

Ven
Ven
16:35
There are easier ways to go at it :)
@xpqz I started with your solution, ended up with a better solution using , though without the parsing step of the string
17:05
Well I'm pretty happy of parser combinator
I just need to do the "map" feature
https://x.com/_Akanoa_/status/1731358784482607353?s=20
@Akanoa how do you parse zoneighteen and get 18?
oops I spoiled part two
@Ven Hint: a stencil window size of 1 5 to get numbers, and 3 3 to handle symbols, then 1 3 to filter our excessive numbers
Ven
Ven
@LdBeth That's just specialcasing the input, right?
there's nothing that says a number has to be 3 chars at most
@Ven You can used a iterative flooding of 1 3 window to get the numbers, whiteout assuming the max number length
*without
Ven
Ven
Dunno how to do that
17:16
@l
@Ven Start with each location holds its single digit, each iteration, get the number of the two nearby cells, update as necessary, until the map stabilized. Assume max size of 3 would be much efficient than this, of course, and this can be verified easily using regexp search.
minor spoiler on day1 part2




@LdBeth if i've parse the term "eighteen" I can remap it as 18 integer
but as I see, the number in letters or not range between 1 to 9
'7pqrstsixteen', "sixteen" is a fake news because the last number is a 6 not 16 :p

so my parser only need to range "one", "two", .... "nine"
and "1", "2", ..., "9"
Ven
Ven
eighteen is a trap
17:33
Hello,
I'm new to Code Golf, what is APL Orchard, how can I prepare for it and how to find information about it?
Ven
Ven
17:53
I don't understand stencil. {⊂≢⍵}⌺ or {⊂⊃⍵}⌺ don't give me the results I expect at all
@LuckyChouhan Welcome! This chat room is the APL Orchard. See apl.wiki/APL_Orchard
@Ven What is the right operand?
Ven
Ven
My day3 advent input, split on space, mixed. 10 10≡⍴
I don't follow, neither what you are saying, nor AoC, but the right operand to should be the windows size and optionally the movement.
Ven
Ven
oh no I mean, I called is as {⊂≢⍵}⌺1 5⊢data
that wasn't clear, sorry
Then ≢⍵ is always 1.
in the left operand is simply the current window.
Ven
Ven
18:10
I'll just 1⌷ then
Or ,
@Ven How wide is data?
Ven
Ven
⍴data is 10 10
Ah.
Ven
Ven
↑' '(≠⊆⊢)'467..114.. ...*...... ..35..633. ......#... 617*...... .....+.58. ..592..... ......755. ...$.*.... .664.598..'
Basically, this, and the task is to find the numbers there, but only when there's a non-dot symbol around it. So I was trying to figure out how to do that.
Numbers or digits?
Ven
Ven
18:24
numbers, digits would be easy
I'd stencil 3 3, check if it's a digit in the middle, and check the rest
Ah, around it like that.
So why 1 5?
Ven
Ven
@LdBeth ^
I considered doing a 3 5 stencil at first.
and 2↓¯1⌽
18:49
 numbermap←{
     parsn←{
         l←,⍵
         ~l[3]∊⎕D:0
         ~∨/l[2 4]∊⎕D:⍎(,⍵)[3]
         s←' .%#*$/-&+@='split l
         3=≢s:⍎2⊃s
         2=≢s:⍎s⊃⍨1+</≢¨s
         1=≢s:⍎⊃s
         0
     }
     parsn⌺1 5⊢⍵
 }
The 3=≢s:⍎2⊃s case won't happen though
Ven
Ven
OK, I got {⊂2↓¯1⌽2⌷⍵}⌺, now I need to parse either 2 or 3 digits from what's left there
@Adám Because the number is assumed to be at most 3 digits wide, so a window of width 5 can do the thing in one pass.
Ven
Ven
19:04
I do 2↓¯1⌽ on and on 2⌷⍵, figure out if any of these is a symbol
@LdBeth Ah.
@Ven this is just {2 2⌷⍵}⌺3 3 isn't it, also you are getting a vector instead of scalar.
Ven
Ven
I guess I can actually just check ,⍵, check if there's anything's besides '.',⎕D
@LdBeth hm?
That only selects an element
Why would you want windows to be 3 5?
Ven
Ven
because I can see all the characters around
19:16
...+. ..+..
123.. 23...
..... .....
Now you have these two windows next to each other, how do you determine what number is next to the +?
...+. ..+..
.23.. 23...
..... .....
And differentiate the case above with this one?
19:31
Welp turns out that is quite feasible
Very funny ^^
@LdBeth my mapping is ready, now I need to move my parsing cursor and accumulate
but tomorrow :p
https://x.com/_Akanoa_/status/1731395652637106672?s=20
 
3 hours later…
Ven
Ven
23:01
I got to this, but it's too slow to run in TryAPL:

+/+/{⊂(~×/(,⍵)∊' .',⎕D)×(~(2 1⌷⍵)∊⎕D)×((2 2⌷⍵)∊⎕D)×⍎(v∊⎕D)/v←'0',2↓¯1⌽2⌷⍵}⌺3 5⊢↑' '(≠⊆⊢)input
Mh, that doesn't seem correct, unsure why :(
It works fine with the simpler example...

« first day (2503 days earlier)      last day (369 days later) »