tangled
alpha
login
or
join now
eldridge.cam
/
advent-of-code
2
fork
atom
Advent of Code solutions
2
fork
atom
overview
issues
pulls
pipelines
moved to stdlib
eldridge.cam
3 months ago
c867803f
b8c2d3a8
+1
-10
1 changed file
expand all
collapse all
unified
split
2025
10
p1.tri
+1
-10
2025/10/p1.tri
···
33
33
return target:buttons
34
34
}
35
35
36
36
-
func choose 0 _ = do() yield 'next([])
37
37
-
func choose _ [] = do() {}
38
38
-
func choose n [x, ..xs] = do() {
39
39
-
let within = choose (n - 1) xs |> it::map (prepend x)
40
40
-
let without = choose n xs
41
41
-
within!()
42
42
-
without!()
43
43
-
}
44
44
-
45
36
func solve target:buttons =
46
37
it::rangex 1 (length buttons)
47
47
-
|> it::flat_map (fn n. choose n buttons)
38
38
+
|> it::flat_map (fn n. it::choose n buttons)
48
39
|> it::find (fn chosen. target == reduce (^) chosen)
49
40
|> length
50
41