···33import "trilogy:array" use filter, map, fold, collect
44import "trilogy:parsec" use parse, integer
5566-func is_digit '0' or '1' or '2' or '3' or '4' or '5' or '6' or '7' or '8' or '9' = true
66+func is_digit '0' = true
77+func is_digit '1' = true
88+func is_digit '2' = true
99+func is_digit '3' = true
1010+func is_digit '4' = true
1111+func is_digit '5' = true
1212+func is_digit '6' = true
1313+func is_digit '7' = true
1414+func is_digit '8' = true
1515+func is_digit '9' = true
716func is_digit _ = false
817918func combine [a] = "${a}${a}"
+26
2025/1/p1.tri
···11+import "trilogy:debug" use dbg
22+import "trilogy:io" use readline
33+import "trilogy:parsec" use parse, char_of, integer, apply
44+55+proc rotation!() {
66+ let dir = apply <| char_of "LR"
77+ let amt = apply integer
88+ return if dir == 'R' then amt else -amt
99+}
1010+1111+func rotate amt pos = (pos + amt) % 100
1212+1313+proc main!() {
1414+ let mut zeros = 0
1515+ let mut pos = 50
1616+ while true {
1717+ let rot = with parse rotation readline!()
1818+ when 'eof cancel break unit
1919+ else yield
2020+ pos rotate= rot
2121+ if pos == 0 {
2222+ zeros += 1
2323+ }
2424+ }
2525+ dbg!(zeros)
2626+}
+5-1
Justfile
···4343 cabal build {{part}} > /dev/null
4444 else if test -f {{part}}.erl
4545 erl -compile "$fn"
4646+ else if test -f {{part}}.tri
4747+ trilogy compile {{part}}.tri > {{part}}.ll
4848+ clang-19 -O3 {{part}}.ll -o {{part}}
4949+ rm {{part}}.ll
4650 else if test -d {{part}} -a -f {{part}}/gleam.toml
4751 pushd {{part}}
4852 gleam build
···6468 else if test -f {{part}}.pl
6569 time swipl -s "$fn" -g main,halt < {{input}}
6670 else if test -f {{part}}.tri
6767- time trilogy run "$fn" < {{input}}
7171+ time trilogy run {{part}}.tri < {{input}}
6872 else if test -f {{part}}.py
6973 time python3 "$fn" < {{input}}
7074 else if test -f {{part}}.rb