Lisp is homoiconic, meaning code can be treated as data. Which implementations allow me to do so at runtime? The following is an example of what I mean, in pseudocode:
(defun (my-func)
(display "foo ")
(display "bar ")
(display "baz "))
(defun (main-loop)
(my-func)
(swap (first my-func) (second my-func))
(main-loop))
That should repeatedly output "foo bar baz bar foo baz ".
This is probably not the most elegant approach, but in common Lisp you can do something like this:
This stores a Lisp function in
f
rather than executing it in situ, but it does illustrate the fact that a Lisp program is itself a Lisp data structure than can be dynamically manipulated and executed.