From 12002d17a6052b91a803eba5c31d40f04af9ef37 Mon Sep 17 00:00:00 2001 From: Lee Spector Date: Sun, 22 Nov 2020 16:19:24 -0500 Subject: [PATCH] Make plushy->push obey :diploid setting --- src/propeller/genome.cljc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/propeller/genome.cljc b/src/propeller/genome.cljc index 5c12462..8d2bbed 100755 --- a/src/propeller/genome.cljc +++ b/src/propeller/genome.cljc @@ -12,7 +12,8 @@ (defn plushy->push "Returns the Push program expressed by the given plushy representation." [plushy argmap] - (let [opener? #(and (vector? %) (= (first %) 'open))] ;; [open ] marks opens + (let [plushy (if (:diploid argmap) (map first (partition 2 plushy)) plushy) + opener? #(and (vector? %) (= (first %) 'open))] ;; [open ] marks opens (loop [push () ;; iteratively build the Push program from the plushy plushy (mapcat #(if-let [n (get push/opens %)] [% ['open n]] [%]) plushy)] (if (empty? plushy) ;; maybe we're done?