2 ms·
About method chains and Lisp: in Clojure you can write code very similar to that using threading macros: (-> (args) (skip 1) (next) (unwr
by kaashif 4y ago
About method chains and Lisp: in Clojure you can write code very similar to that using threading macros:
(-> (args)
(skip 1)
(next)
(unwrap)
(length))
I really do think that for long "Java-esque" chains like this, Clojure has the right idea, I think it's very readable.
This isn't really related to the Lisp to Rust transpiling thing though.
- tmtvl 4y agoThere is an SRFI for a chain macro which works like that, but the problem is that we'd need to figure out for each call whether we need to transpile it to a function or a method call. And I agree with you that that S-expression notation is very readable, at least for us who are used to putting the parentheses in the correct spot.