2 ms·
As usual, one just need a paredit equivalent to forget about parens forever. I also remember an extension (maybe emacs, or a scheme SRFI) removing the top-level
by agumonkey 12y ago
As usual, one just need a paredit equivalent to forget about parens forever. I also remember an extension (maybe emacs, or a scheme SRFI) removing the top-level parens (implicit rewriting rule).
repl> defun id (x) x
repl> defun fact (n)
(if (< n 2)
1
(* n (recur (1- n))))
A little more pleasant for people used in curly braces I'd say.
- xiaq 12y agoCodes are read much more often than written. paredit makes editing parens easier, but reading them is still difficult for the unskilled (rainbow parens help, but it's still far from painless). Compare this to how autocompletion makes it easier to write a VeryVeryVeryVeryVeryVeryVeryLongMethodName but doesn't make it any easier to read.
- agumonkey 12y agoI don't know, properly abstracted LISP code is 'supposed' to be tiny (you have all you need to write nice DSL/API) so you don't have long winded things on screen. And I have a differing opinion about code meant to be read. This is a side effect of syntaxful languages read statically in buffer editors. You want to understand LISP ? you load the code, play with and evaluate sub expressions, and sexps/paredit is of great help here.
- rcfox 12y agoI think you're referring to sweet-expressions. http://srfi.schemers.org/srfi-110/srfi-110.html http://srfi.schemers.org/srfi-110/srfi-110.html
- agumonkey 12y ago--Nope-- Kinda, I actually blended this with something else, which was more of a simple editor hack to avoid typing the top parens. Now things are clear. Thanks for the link though. Anybody actually wrote code in sw-exps ?