Advent of Code solutions

moved to stdlib

+1 -10
+1 -10
2025/10/p1.tri
··· 33 return target:buttons 34 } 35 36 - func choose 0 _ = do() yield 'next([]) 37 - func choose _ [] = do() {} 38 - func choose n [x, ..xs] = do() { 39 - let within = choose (n - 1) xs |> it::map (prepend x) 40 - let without = choose n xs 41 - within!() 42 - without!() 43 - } 44 - 45 func solve target:buttons = 46 it::rangex 1 (length buttons) 47 - |> it::flat_map (fn n. choose n buttons) 48 |> it::find (fn chosen. target == reduce (^) chosen) 49 |> length 50
··· 33 return target:buttons 34 } 35 36 func solve target:buttons = 37 it::rangex 1 (length buttons) 38 + |> it::flat_map (fn n. it::choose n buttons) 39 |> it::find (fn chosen. target == reduce (^) chosen) 40 |> length 41