I quite liked if-let. Interestingly it is very similar to the let%bind name = monadic_value in … in OCaml when using ppx_let and Core which I use a lot. It is also similar to the do notation in Haskell.
Both are sort of more general versions of if-let since they don’t hardcode on the truthfulness of the value but rather can be defined per-monad.
Feel free. I did it like that because it clearly shows where the actual snippets of code begin and end, including leading/trailing punctuation/whitespace.
I like the improved style vs. Graham’s implicit bindings, but for whatever reason binding conditionals in Lisp never gained traction. Perhaps they are just harder to read.
These are(were?) super common in Clojure, fwiw. I can’t fathom a reason they ‘d be popular in Clojure, but not in Common Lisp, other than one having a Lisp-1 and a community that hates typing more characters than necessary…but in that case, the implied ‘it Would be better….
Right. The barrier to entry is far less in Clojure, but the idea of binding conditionals was not new in Clojure. So there was lots of opportunity for CL users to adopt it, and for it to end up in SBCL’s standard library, or be a quicklisp library away. That seems to have not happened.
I quite liked
if-let. Interestingly it is very similar to thelet%bind name = monadic_value in …in OCaml when usingppx_letand Core which I use a lot. It is also similar to thedonotation in Haskell.Both are sort of more general versions of
if-letsince they don’t hardcode on the truthfulness of the value but rather can be defined per-monad.Bonus points for
declare!Thanks @sjl. But now I miss Lisp even more. (And I also appreciate Lisp-2s!)
I do most of my personal projects in Lisp, so there’s nothing to miss.
Most of this went over my head (I’m not a lisp person), but I want to say I love your “give code a grey background” CSS. Mind if I steal it?
Feel free. I did it like that because it clearly shows where the actual snippets of code begin and end, including leading/trailing punctuation/whitespace.
I do a a similar thing only the left border uses the colors that Github uses to mark languages.
Related to anaphoric macros.
I like the improved style vs. Graham’s implicit bindings, but for whatever reason binding conditionals in Lisp never gained traction. Perhaps they are just harder to read.
These are(were?) super common in Clojure, fwiw. I can’t fathom a reason they ‘d be popular in Clojure, but not in Common Lisp, other than one having a Lisp-1 and a community that hates typing more characters than necessary…but in that case, the implied
‘itWould be better….They’re included in the Clojure standard library, but you have to write them yourself in CL (or use a library). That’s probably why.
Right. The barrier to entry is far less in Clojure, but the idea of binding conditionals was not new in Clojure. So there was lots of opportunity for CL users to adopt it, and for it to end up in SBCL’s standard library, or be a quicklisp library away. That seems to have not happened.
How hard would it be to make these without the Alexandria dependency? (I’d try it myself but just don’t have the time and energy currently.)
with-gensymsis trivial to replace.parse-bodywould be tougher, but still isn’t too bad.