(when (0 . < . x)
(displayln "positive"))
Although in Racket you could also add your own syntax. (when (0 . < . x)
(displayln "positive"))
Although in Racket you could also add your own syntax. > '%mult%' <- function(a,b) a*b
> 3 %mult% 5
[1] 15
Using infix operators as functions: > '*'(3,5)
[1] 15I 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))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.
(0 . < . x . < . 12)
read-syntax: illegal use of `.`
Typing those extra '.'s gets annoying very quickly too.Racket has some other things that are non-lispy. Support for alternate (maybe non-SEXP) syntax readers and for loops come to mind.
At least it's all simple. Sometimes terrifyingly simple, but simple.
They're useful too. Non-SEXP reader could be used to create a non-infix dialect of Racket. Loop macros like for/or can be used as a more ergonomic way than recursive functions to walk a list to find/transform one of its elements.
The double dot notation is mostly used for inequalites:
(x . < . 3) instead of (< x 3)
and for function contracts: (any . -> . boolean?) instead of (-> any boolean?)