Ben Cohen on Nostr: and for the code golf enthusiasts, part 1 in one line (no semicolons allowed) ...
and for the code golf enthusiasts, part 1 in one line (no semicolons allowed)
print(sequence(state:0){_ in readLine()}.reduce(0){$0+{$0[0]*10+$0.last!}($1.compactMap(\.wholeNumberValue))})
Published at
2023-12-02 00:57:13Event JSON
{
"id": "3546e54cc8bf0d6bc0a3b9f00a503e91dd21d53025149f708e936f1bac88f791",
"pubkey": "d2c7e7c0b6bdf9cd41e14c5d989c6b422d8ba011d2622937f2596a5b23425fb6",
"created_at": 1701478633,
"kind": 1,
"tags": [
[
"e",
"b1b6fe0eccd38353ef5b883028612c0714b4c697ff5e28e84e3927298e2e4652",
"wss://relay.mostr.pub",
"reply"
],
[
"content-warning",
"Advent of Code spoilers"
],
[
"proxy",
"https://mastodon.social/users/airspeedswift/statuses/111508103717123895",
"activitypub"
]
],
"content": "and for the code golf enthusiasts, part 1 in one line (no semicolons allowed)\n\nprint(sequence(state:0){_ in readLine()}.reduce(0){$0+{$0[0]*10+$0.last!}($1.compactMap(\\.wholeNumberValue))})",
"sig": "63f56e25a28febd112594188af03187f9085ee2d80d0e50d4f3f2046f7ad4b1f4278da7dfb22284b749f9e3ea2431d1f4931c2e9416a993037a34aabe7631e92"
}