more cleanups
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
(prop/remove-property! thought (magic/extension-prop stage)))
|
||||
thought)
|
||||
|
||||
(defn get-extensions
|
||||
(defn extensions-of-stage
|
||||
"Get extensions for `stage`;
|
||||
e.g. for `stage` of [:foo :bar :baz], get extensions for [:foo :bar :baz], [:foo :bar], [:foo]"
|
||||
[stage]
|
||||
@@ -30,26 +30,25 @@
|
||||
(recur (butlast property-segment)
|
||||
(union acc (prop/with-property (magic/extension-prop property-segment)))))))
|
||||
|
||||
;; XXX contains references to scrapped "contract" subsys
|
||||
(defn extensions
|
||||
(defn extensions-of-thought
|
||||
"Get extensions of `thought`.
|
||||
Returns a map of {stage => #{thought}}."
|
||||
[thought]
|
||||
(let [stages (thought/stages thought)
|
||||
aspects (map get-extensions stages)]
|
||||
(zipmap stages aspects)))
|
||||
all-extensions (map extensions-of-stage stages)]
|
||||
(zipmap stages all-extensions)))
|
||||
|
||||
(defn pop-stage
|
||||
"Get aspects of next stage of thought execution.
|
||||
Returns a tuple of (#{extensions},
|
||||
a copy of `thought` with its first extension-stage removed)."
|
||||
Returns a tuple of (#{extensions}, though w/ (tail stages), :stage)"
|
||||
[thought]
|
||||
(let [stages (thought/stages thought)
|
||||
aspects (get-extensions (first stages))
|
||||
extensions (extensions-of-stage (first stages))
|
||||
stage-name (first stages)
|
||||
|
||||
modified (prtc/copy-fn #(assoc % :ext-stages (rest stages))
|
||||
thought)]
|
||||
(list aspects modified)))
|
||||
(list extensions modified stage-name)))
|
||||
|
||||
(defn has-stage?
|
||||
"Return true if `thought` has extension stage `stage`.
|
||||
|
||||
Reference in New Issue
Block a user