I tried converting your solutions to Typed Racket without changing a line of code. My plan was to find places where the type system couldn't follow a reasonable programmer's reasoning.
And indeed there were many such places. Sadly most were with for loops, so I just changed the code (best case: changing for/first to for/or). Also, using ann is always sad (e.g. day10). But there were a few places I could use trivial/regexp to macro-expand a use of regexp-match and convince TR that the groups would always capture.
Well, now you know these typed versions exist. Here's hoping that by the end of the summer the code in some of these can deviate less from the untyped versions.
Hi Matthew B,
I tried converting your solutions to Typed Racket without changing a line of code. My plan was to find places where the type system couldn't follow a reasonable programmer's reasoning.
And indeed there were many such places. Sadly most were with for loops, so I just changed the code (best case: changing `for/first` to `for/or`). Also, using `ann` is always sad (e.g. [day10](https://github.com/mbutterick/aoc-racket/compare/master...bennn:typed?expand=1#diff-df7d8c4873e3cc53f3cb84e3f6552ac0R12)). But there were a few places I could use [trivial/regexp](https://docs.racket-lang.org/trivial/index.html?q=trivial%2Fregexp#%28mod-path._trivial%2Fregexp%29) to macro-expand a use of `regexp-match` and convince TR that the groups would always capture.
Well, now you know these typed versions exist. Here's hoping that by the end of the summer the code in some of these can deviate less from the untyped versions.
Hi Matthew B,
I tried converting your solutions to Typed Racket without changing a line of code. My plan was to find places where the type system couldn't follow a reasonable programmer's reasoning.
And indeed there were many such places. Sadly most were with for loops, so I just changed the code (best case: changing
for/first
tofor/or
). Also, usingann
is always sad (e.g. day10). But there were a few places I could use trivial/regexp to macro-expand a use ofregexp-match
and convince TR that the groups would always capture.Well, now you know these typed versions exist. Here's hoping that by the end of the summer the code in some of these can deviate less from the untyped versions.
Santa's elves thank you.