4 ms·
I just assumed Racket supports curly infix notation, but looking just now I see that you need to use the infix pragma and wrap things with @{} I liked GNU Guil
by mhitza 5y ago
I just assumed Racket supports curly infix notation, but looking just now I see that you need to use the infix pragma and wrap things with @{}
I liked GNU Guile for the fact that it's enabled by default, thus the following is a bit more readable in my opinion
(when { 0 < x }
(diplay "positive") (newline))
- soegaard 5y agoFWIW a user can add this syntax himself to a language if he needs to. A hypothetical `curly-infix` language could be used like this: #lang curly-infix racket (define (fact n) (if (= n 0) 1 {n * fact(n-1)})) The reader for `curly-infix` can use a read-table to alter how `{<infix-expression>}` is read. The result can the be passed to the language after the `#lang curly-infix` which in the example is just `racket`, but could be something else. Hmmm. Maybe I should make a `curly-infix` wrapping `infix` from my `infix` package.