Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
Kodiologist
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
6 ms
·
31.
▲
by
Kodiologist
4y ago
I'm not familiar with Jupyter internals, but I think functions would work well for this. Hy allows multi-statement anonymous functions, and you can do stuff like `((fn [] … ))` to define and immediately call the function. One advantage
32.
▲
by
Kodiologist
4y ago
In some other Lisps, yes, but Python has its own idea of how function scoping works that generally isn't what you'd want with `let`. For example, in (let [a 1] (defn foo [] (setv a 2)) (foo) (print
33.
▲
by
Kodiologist
4y ago
Hy has closures. They work just like Python's. (Common Lisp is super cool, though. Perhaps one day Hy will be as cool.)
34.
▲
by
Kodiologist
4y ago
Even with PyPy, or Python libraries that are themselves written in C?
35.
▲
by
Kodiologist
4y ago
It's been implemented, found to be subtly broken, and re-implemented a number of times. Ultimately trying to impose a different model of scoping on top of Python's scoping is living in a state of sin; thus the difficulties. The st
36.
▲
by
Kodiologist
4y ago
I'm not familiar with such a feature, but you can certainly run a Hy program and edit its state in the REPL at the same time, if that suffices.