lspector/Clojush — pull request #35 by thelmuth (2012-11-13 18:55:37+00:00)
Title: Environments

This pull implements all of the environment ideas we have discussed, besides the tagging+return instructions like return_tag_integer_123. The tagging instructions were more difficult than I had first imagined. My first attempt (that I'm pretty sure is wrong) is:

```(defn return-tag-instruction-erc
"Returns a function which, when called on no arguments, returns a function of Push
state that pushes a literal followed by a tagging instruction of the same type."
[types limit]
(fn []
(let [type (lrand-nth types)
index (str (lrand-int limit))
tag-instruction (symbol (str "tag_" (name type) "_" index))]
(fn [state]
(if (empty? (type state))
state
(let [item (list (top-item type state) tag-instruction)]
(push-item item :return state)))))))```