Unable to load image

r/drama Advent of Code S02E01 - Official DISCUSSION Thread

Ok you Python-using heathens. What did you think for difficulty this time around?

Post your coding atrocities below.

For those of you who missed the early signups. Feel free to join the leaderboard late (though rankings are based on time).

42
Jump in the discussion.

No email address required.

r←⊃⎕NGET'i1.txt'1
d←'one' 'two' 'three' 'four' 'five' 'six' 'seven' 'eight' 'nine'
f←{+/⍎¨(1∘↑,¯1∘↑)¨(∊∘⎕d⊢⍤/⊢)¨⍵}
g←{m←+/¨p←⍷∘⍵¨d ⋄ (m/'123456789')@(∊(⊢⊢⍤/⍳∘≢)¨p)⊢⍵}
⎕←f r ⋄ ⎕←f g¨r
Jump in the discussion.

No email address required.

apl

you got me into it. i started learning dyalog a few days ago. i wanted to play with the bitmask aspect of it so i did this

input←⊃⎕NGET 'i1.txt' 1

⍝ First we begin by defining our functions
Nums←{⍵∩'0123456789'}
]dinput
GetLongValue←{
   left←⊣/⍵
   right←⊢/⍵
   ⍎left,right
}

⍝ Next we process our input so that we trim out the text characters
Processed←Nums¨input ⍝ All the numbers in the input lines

⍝ Next were going to create input masks to apply different logic based on if a line has >=2 numbers or not
NormalInputsMask←{(⍴⍵)>1}¨Processed ⍝ This mask will be used for  long values
ShortInputsMask←~NormalInputsMask ⍝ This mask will be used for short values

ShortValues←(⊃¨ShortInputsMask)/Processed
LongValues←(⊃¨NormalInputsMask)/Processed

Short←⍎¨2/¨ShortValues
Long←GetLongValue¨LongValues
((+/Long)++/Short)
Jump in the discussion.

No email address required.

you didnt answer me last year so im gonna ask again, do you own an apl keyboard? i cant imagine trying to write apl without one but i also cant imagine learning how to use one.

Jump in the discussion.

No email address required.

I use a regular physical board (right ctrl to switch layouts) with the layout open in a terminal:

https://i.rdrama.net/images/170141423679296.webp

You barely look at the keyboard when you're typing anyway.

Jump in the discussion.

No email address required.

neat, ty

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.