« first day (2514 days earlier)      last day (147 days later) » 

6:13 AM
Completed day14 in APL using dyadic , what a grief!
 
 
6 hours later…
12:28 PM
Hi all, first-time poster here, still a beginner, but really enjoying Dyalog APL.

>> AoC Day 14 spoiler <<

I'm quite happy with my solution, though I'm sure someone will be able to improve on it:

p←↑⊃⎕NGET'p14.txt'1
+/⊢/↑⍸'O'={'O\.'⎕R'.O'⊢⍵}⍤1⍣≡⊢⌽⍉p
 
 
1 hour later…
1:51 PM
Welcome!
'O\.'⎕R'.O' is a complete function, so you can just write that instead of {'O\.'⎕R'.O'⊢⍵}. Also I think it's faster to put ⍣≡ before ⍤1 so that you stop doing replacements for each row as soon as it doesn't change anymore. And the before is unnecessary, because and are both functions, so they won't combine like arrays do.
 
 
3 hours later…
4:24 PM
APLcart has {↑⍺⍵} for "Two-row matrix from two vectors (pad shorter vector)". Is there a nicer way than ↑⌊⍥≢↑¨,⍥⊂ to do the same thing but instead of pad the shorter vector, truncate the longer vector?
 
5:02 PM
@JonathanCarroll Welcome! I recommend taking a minute to familiarise yourself with apl.wiki/APL_Orchard#Features — where you can e.g. learn how to format code in monospace font.
@rabbitgrowth I don't think so.
 
 
4 hours later…
9:21 PM
fantastic, thankyou! So then `+/⊢/↑⍸'O'='O\.'⎕R'.O'⍣≡⍤1⌽⍉p` or `+/∊⍸¨'O'=↓'O\.'⎕R'.O'⍣≡⍤1⌽⍉p`

both end up with the same number of glyphs.
@Adám Thanks! I'm clearly doing something wrong with the inline syntax, sorry.
 
9:53 PM
@JonathanCarroll The inline syntax only works for a message without line breaks. Instead of using a multi-line message, simply post multiple consecutive messages, and they'll be visually joined as paragraphs.
Btw, I suspect (not tested) that +/∊⍸¨'O'='O\.'⎕R'.O'⍣≡↓⌽⍉p works.
 
10:11 PM
@Adám thank you! And yes, that does work; once the transpose is done there's no need for the matrix structure at all.
 
Btw, I believe we'll be adding the ability to read a text file directly to a matrix, i.e. p←⊃⎕NGET'p14.txt'2
 
@Adám Ooh! I've seen lots of people using helpers in their AoC solutions (in other languages) that do this because it's so common. Is the implementation much different to just mixing the flag=1 version?
 
10:48 PM
@JonathanCarroll Yeah, it can read in the data straight to a single memory pocket, instead of building one pocket per line, only to need rewriting eveything into a single pocket upon Mix.
 
@Adám That makes sense, cheers!
 

« first day (2514 days earlier)      last day (147 days later) »