Solving LeetCode problems with Racket: I don't know what I expected(herecomesthemoon.net)
herecomesthemoon.net
Solving LeetCode problems with Racket: I don't know what I expected
https://herecomesthemoon.net/2024/11/leetcode-with-racket/
https://herecomesthemoon.net/2024/11/leetcode-with-racket/
If you use typed/racket, they compiler checks a lot of them at compilation time, and even use them to eliminate implicit types checks.
There is some magic when you use in-range inside map like:
It would be nice if the compiler can automatically fix this examplet, but it has to be an incredible smart compiler.
> Let’s take a look at how the Racket standard library implements this macro (this is what proper Racket formatting looks like, apparently).
A lot of Racket is written in a simplified version of Racket informally call #'kernel. The problem is that #'kernel is very difficult to use because it has only the minimal stuff. One of the first definitions is `and`, so that explains the ugly definition. After a few modules that add more and more friendly tools, it's possible to define `and` as