Hacker News new | ask | show | jobs
by hibbelig 830 days ago
I think you need to go down the conditionals in order anyway, if cond* it’s like cond in that it evaluates the conditions top to bottom. So keeping track of “all the bindings so far” makes intuitive sense to me.

I also see a parallel to if/else if/else cascades. You can “break” and else if leg into … else { zzz; if (…) … } and then you can declare new variables at the zzz spot that are then available for the rest of the cascade.

I don’t know much about pcase and cond* so I can’t speak to the more general point. I just wanted to mention one specific aspect.

I miss emacs but as a Java developer what can you do…

1 comments

Evaluating conditions don't introduce bindings in COND. In Lisp typically bindings are only introduced in forms together with scope: DEFUN, LET, and a lot of other constructs. Binding construct which affect forms outside its syntactic scope is rare in Lisp.

In Scheme there is sometimes:

    (define (foo)
      (define a 10)
      (+ a 42))
But even there all the embedded "define"s, by standard, need to be at the top of the body, directly at the start.