Make plushy->push use an empty argmap if none was passed.
This commit is contained in:
parent
0a5e17195e
commit
aadc28d371
@ -11,7 +11,8 @@
|
|||||||
|
|
||||||
(defn plushy->push
|
(defn plushy->push
|
||||||
"Returns the Push program expressed by the given plushy representation."
|
"Returns the Push program expressed by the given plushy representation."
|
||||||
[plushy argmap]
|
([plushy] (plushy->push plushy {}))
|
||||||
|
([plushy argmap]
|
||||||
(let [plushy (if (:diploid argmap) (map first (partition 2 plushy)) plushy)
|
(let [plushy (if (:diploid argmap) (map first (partition 2 plushy)) plushy)
|
||||||
opener? #(and (vector? %) (= (first %) 'open))] ;; [open <n>] marks opens
|
opener? #(and (vector? %) (= (first %) 'open))] ;; [open <n>] marks opens
|
||||||
(loop [push () ;; iteratively build the Push program from the plushy
|
(loop [push () ;; iteratively build the Push program from the plushy
|
||||||
@ -33,4 +34,4 @@
|
|||||||
(concat pre-open [post-open ['open (dec num-open)]])))
|
(concat pre-open [post-open ['open (dec num-open)]])))
|
||||||
(rest plushy))
|
(rest plushy))
|
||||||
(recur push (rest plushy))) ;; unmatched close, ignore
|
(recur push (rest plushy))) ;; unmatched close, ignore
|
||||||
(recur (concat push [i]) (rest plushy)))))))) ;; anything else
|
(recur (concat push [i]) (rest plushy))))))))) ;; anything else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user