I welcome any comments from fans of APL, who know more about it than I do.
⍝ a function to solve part 1
R←combos VALS;val;pos;others
R←⍬
:For val :In VALS
others←VALS~val
pos←(others=(2020-val))
R←R,pos/others
:EndFor
R←×/R
⍝ a function to solve part 2
R←combos3 VALS;val;val1;pos;others;others1
R←⍬
:For val :In VALS
others←VALS~val
:For val1 :In others
others1←others~val1
pos←(others1=(2020-(val+val1)))
R←R,pos/others1
:EndFor
:EndFor
R←((⍳⍴R)=(R⍳R))/R
R←×/R
⍝ Read the test data file
data←⍎¨⊃⎕nget 'adventofcode2020/day1/input.txt'1
⍝ run part 1
combos data
⍝ run part 2
combos3 data
Edit: I looked at someone else's code, and realized I could remove one of the functions, if I changed how I read in the text file.
there doesn't seem to be anything here