« first day (2515 days earlier)      last day (134 days later) » 

2:05 AM
Mine for day 14
 res←fall2 input;bs;idx
 bs←⍸'#'=input,'#'
 idx←∊bs{⍺+iotag-⍵}¨{¯1+≢⍵}⌸(¯1+⍳≢bs),bs⍸⍸'O'=input
 res←'.'⍴⍨⍴input
 res[idx]←'O'
 res[¯1↓bs]←'#'
And north←{⍉⌽fall2⍤1⌽⍉⍵} etc.
that is, find the location of # and compute number of Os and directly build stabilized result
 
For part 2 it was satisfying when it clicked that my {⍉⊖Tilt⊖⍉⊖Tilt⊖⍉Tilt⍉Tilt⍵} could be simplified to ⌽⍤⍉⍤Tilt⍣4 :)
@Adám Nice. I like how 1 and 2 match up with the rank of the output.
I actually tried doing ⊃⎕NGET'file'2 in RIDE on my AoC input a few days ago and was surprised it worked, except it didn't; the character vector it was outputting just looked like a character matrix since there were newlines in it.
Looks like ⎕NGET actually does 2∘| to the numeric code?
      {≡⊃⎕NGET'14.txt'⍵}¨⍳10
2 1 2 1 2 1 2 1 2 1
 
2:30 AM
likely
 
Why would it do that instead of raising a DOMAIN ERROR?
 
3:18 AM
I guess it is because the subroutine checking for arguments are kinda shared between a family of system functions and there is no customization for checking flag range
 
 
3 hours later…
6:33 AM
For day15 I did part2 in emacs lisp, although the hash function is really simple in J hash =: [:]F..(256|17*+)0,a.i.]
 
 
1 hour later…
7:42 AM
AoC Day 15 Part 1 (Dyalog APL)
p←⊃⎕NGET'p15.txt' 1
p←⊃','(≠⊆⊢)¨p
hash←{⍺←0 ⋄ 0=≢⍵:⍺ ⋄(256|17×⍺+⎕UCS⊃⍵)∇ 1↓⍵}
+/hash¨p
(the recursive nature of this really had me stumped for a bit - lots to learn!)
 
 
2 hours later…
10:02 AM
@JonathanCarroll That is simply reduce (or fold), just be aware APL folds from right to left hash←{(256|17×+)/(⌽⎕UCS⍵),0}
 
Or tacit: (256|17×+)/∘⌽0,⎕UCS
 
 
1 hour later…
11:15 AM
can't make it to today's quest - here's my solution: (⌊⌿1-⍨⍳⍨∘,)(↑⍮↓)⊢
 
12:08 PM
@LdBeth I'm fairly sure that me forgetting the right-to-left part is why my attempts along that route failed. Thanks! @Adám - even better!
 
12:47 PM
@RubenVerg ⍮ being ,⍥⊂ ?
 
1:00 PM
Welcome to APL Quest 2022-8! Today's quest is Let’s Split!:
> Write a function that:
• takes a right argument that is a non-empty character vector or scalar.
• takes a left argument that is a non-empty character vector or scalar.
> • returns a 2-element vector of character vectors in which the right argument is split immediately before the first occurence of any element in the left argument. If no left-argument element occurs in the right argument, then the split should happen after the last element of the right argument.
Here's one solution:
2 hours ago, by RubenVerg
can't make it to today's quest - here's my solution: (⌊⌿1-⍨⍳⍨∘,)(↑⍮↓)⊢
@Silas Where indeed means ,⍥⊂
Here's a fun solution using an inverse: {w⊂⍨⍸⍣¯1⊢1,⌊⌿⍺⍳⍨w←,⍵}
 
I do not have my solution by hand.
 
You can try developing one now.
 
I just used partition to mask the input and drop and take to combine the tow halves
 
I'm not sure I follow exactly.
 
what'd the partition mask look like? Tried that route but got stuck and landed with my mostly working
{⎕IO←0 ⋄ (⊃⍸∨⌿↑⍺⍷¨⊂⍵)(↑,⍥⊂↓)⍵}
 
1:07 PM
Sorry. Still not very good at typing on
my phone.
just amoment
 
@Silas Why instead of =?
 
because thought about finding ⍺ so ⍷
 
Pick omega partition commute ~ omega membership alpha
sorry… this is not very nice
this is the first part
 
{⊃⍵⊂⍨~⍵∊⍺}?
 
Yes
And the result of that I combined like:
(enclose t), enclose(shape t) drop omega
where t was the result of the previous one
and I managed to make it tacit which is much smaller
 
1:16 PM
{(⊂t),⊂(⍴t)↓⍵⊣t←⊃⍵⊂⍨~⍵∊⍺} — but that doesn't seem right.
 
Thank you!
The partition enclose should be partition just before the commute
 
{(⊂t),⊂(⍴t)↓⍵⊣t←⊃⍵⊆⍨~⍵∊⍺} passes basic cases.
{⍵⊂⍨1,1↓<\⍵∊⍺} also passes basic cases.
 
ah…
Single letter input on the right probably
 
Also fails when everything goes into one side.
@Adám I like this fix: {2↑(1+@1⊢1,⍨<\⍵∊⍺)⊂,⍵}
 
So what to do? Catch those border issues/edge cases and treat them with a different solution?
 
1:25 PM
Either explicit guards or add fixes like I did here.
 
@Adám this one?
 
What about it?
 
is that the solution you just refered to as the working one?
 
That one works, but {2↑(1+@1⊢1,⍨<\⍵∊⍺)⊂,⍵} is a fixed version of {⍵⊂⍨1,1↓<\⍵∊⍺}
OK, I think we've got plenty of approaches to this one. Let's reconvene next week for 2022-9: An Average Window (or a Windowed Average).
 
Thanks for translating my input and till next week
 
 
8 hours later…
9:34 PM
Hello. I just wanted to ask if it's possible to make a multiplication table with ⍳10 10?
 

« first day (2515 days earlier)      last day (134 days later) »