RCRPG/Clojure: Difference between revisions
no edit summary
Pistacchio (talk | contribs) (refactoring) |
Pistacchio (talk | contribs) No edit summary |
||
Line 32:
(defn valid-actions
"returns all the callable actions from base ones, aliases and user-defined"
[aliases]
(into #{}
Line 164 ⟶ 165:
(defn perform-action
"executes action with args providing it with world state. if the function returns a string, prints it and return
world. if function returns [string updated-world], prints string and return updated-world"
[world action args]
(let [result (apply (resolve (symbol action)) (conj args world ))]
|