News for hackers. Stuff that matters.
Re:Why Hy? by m45t3r on Tuesday May 03, 2022 @02:06PM (#31251456)
For me the example printing `1` makes sense because I think `let` as being something immutable, so I wouldn't expect `setv` to mutate that variable (would expect either a compiler error or the introduction of a new local variable).

But maybe it is because I am familiar with Clojure (where `setv` or equivalents doesn't exist) and not other Lisps.

This would be the equivalent Clojure code anyway:

  user=> (let [a 1] (defn foo [] (def a 2)) (foo) (println a))
  1
  nil
So yeah, makes sense for me. But can understand why some other people would expect the other way though.
Re:Why Hy? by gilch on Tuesday May 03, 2022 @04:04PM (#31252893)
Equivalent in Common Lisp:

    * (let ((a 1))
        (defun foo ()
          (setq a 2))
        (foo)
        (print a))
    
    2
    2