This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
⍝ approach 1 | |
M←⎕json⍠'M'⎕json r⊣{⍺≡'$ cd ..':⍵.##⋄'$'≡⊃⍺:⍵⍎5↓⍺,'←⎕ns⍬'⋄'d'≢⊃⍺:⍵⊣⍵⍎1↓∊'←',¨0(7162⌶)¨@0⌽' '(≠⊆⊢)⍺⋄⍵}/(r←⎕ns⍬),⍨⌽1↓'$ ls'~⍨⍥⊆⊃⎕NGET'7.txt'1 | |
sizes←(∊↑M[;2])+.×⍨{⍵∧∧\1,2≤/⍵}≠\(1=⊢/M)⌿(∘.≤⍨⍳≢M)×∘.≥⍨⊣/M | |
({+/⍵/⍨⍵≤1e5}, {⌊/⍵/⍨⍵≥4e7-⍨⊃⍵}) sizes | |
⍝ approach 2 | |
depth type size←{(+\type) (type←(('$ cd'≡4↑⊢)ׯ1*'.'∊⊢)¨⍵) ({⊃⊃⊢/⎕vfi ⍵}¨⍵)}⊃⎕nget'7.txt'1 | |
sizes←(1=type)/size+.×⍨{{⍵∧∧\1,2≤/⍵}(∘.≤⍨⍳≢⍵)×∘.≤⍨⍵}depth | |
({+/⍵/⍨⍵≤1e5}, {⌊/⍵/⍨⍵≥4e7-⍨⊃⍵}) sizes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#day 1 | |
*a,=map(int,open(0)) | |
print(sum(i<j for i,j in zip(a,a[1:]))) | |
print(sum(i<j for i,j in zip(a,a[3:]))) | |
#day 2 | |
from itertools import accumulate | |
print(sum(d:=[1j**'fd'.find(i[0])*int(i.split()[1]) for i in open(0)]).real*sum(d).imag) | |
print(sum(i.real*j.imag for i,j in zip(d, accumulate(d)))*sum(d).real) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Introduction: Stephen Taylor | |
I want to share with you a tiny origin story that literally no one else in the world knows. There’s an example there of a function being applied to a list of strings, cow, sheep, cat, dog. I’ve often used that list of words in demos and code examples, it comes from a school review in 1965. My friend was introduced, Michael Simpson will now say a few words. Michael walked up to the microphone and said “cow, sheep, cat, dog”. | |
Conor Hoekstra: | |
Alright, welcome to the first episode of ArrayCast, a podcast about array programming languages and the array programming paradigm. My name is Conor Hoekstra, I’ll be your host for today and I think all of the following episodes, and we’re going to go around and do brief introductions with my three cohosts. We’ll go in the order of Stephen, Adám, and then Bob. | |
Stephen Taylor: | |
Hello, I’m Stephen Taylor, I learned, I was shown APL a long time ago, hundreds of years ago I think, back in the days of timesharing services and teletypes, and I immedia |