Re:Hy – A Lisp-flavored Python
by serpix on Thursday August 03, 2017 @06:45AM
(#14918446)
in Clojure this is achieved with `as->`
[ Parent
| on HN ]
In Racket we actually have a threading macro with ~>
This:
(- (bytes-ref (string->bytes/utf-8 (symbol->string 'abc)) 1) 2)
Becomes this:
(~> 'abc
symbol->string
string->bytes/utf-8
(bytes-ref 1)
(- 2))
https://docs.racket-lang.org/threading/index.htmlI believe the use of "~>" rather than "->" in Racket was set in #lang rackjure which adds in some of the Clojure syntax to Racket. Also amusing is their explanation:
> For example the threading macros are ~> and ~>> (using ~ instead of -) because Racket already uses -> for contracts. Plus as Danny Yoo pointed out to me, ~ is more "thready".
http://docs.racket-lang.org/rackjure/index.html#%28part._.Ba...
More thready indeed :-p