3 ms·
Using Clojure as an example (with no regard to quality, not production code and so on). You might have a piece of code like this: (defn people-in-scenes [s
by capableweb 5y ago
Using Clojure as an example (with no regard to quality, not production code and so on). You might have a piece of code like this:
(defn people-in-scenes [scenes]
(->> scenes
(map :subject)
(interpose ", ")
(reduce str)))
You could evaluate the full function and then afterwards you evaluate `(people-in-scenes [{:subject "Test"}])`
But, usually you want to evaluate just a piece, in this case we want to evaluate `(->> scenes ...)` but `scenes` is not in scope?
So we evaluate `(def scenes [{:subject "Test"}])` first and now we have scenes in scope wherever we are, with our test data, and we can select arbitrary snippets around the codebase that depend on `scenes` being in scope.
Repeat for all vars that are expected to be in scope, and you can jump around freely.
Sometimes I leave a statement that defines common data-structures to various names within a `comment` block so it's easy to jumpstart this interactive development when you're in a namespace.
There are other ways as well, but normally this is the easiest to get started with and does the trick for most cases.