This question is a corollary to: Editing programs “while they are running”? Why?
I\'m only recently being exposed to the world of Clojure and am fascinated by a few exam
It's possible in many languages, but only if you have the following features:
Lisp/Clojure has all of these built in by default, which is one of the reasons why it is particularly prominent in the Lisp world.
Example demonstrating these features (all at the Clojure REPL):
; define something in the current namespace
(def y 1)
; define a function which refers to y in the current namespace
(def foo [x] (+ x y))
(foo 10)
=> 11
; redefine y
(def y 5)
; prove that the change was picked up dynamically
(foo 10)
=> 15