From a239d83dfab87bbdebb796ef5a2536aed1f55789 Mon Sep 17 00:00:00 2001 From: Jeremy Penner Date: Fri, 5 Apr 2013 21:10:54 -0400 Subject: [PATCH] state machine macro bugfixes --- src/hottub/stm.clj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hottub/stm.clj b/src/hottub/stm.clj index 32881b2..0c5e753 100644 --- a/src/hottub/stm.clj +++ b/src/hottub/stm.clj @@ -153,12 +153,12 @@ (case (count body) 0 [[] [nil]] 1 [[] body] - body) + [(first body) (next body)]) params (if (< (count params) numargs) (into params (repeatedly (- numargs (count params)) #(gensym))) params)] - [params exprs])) + (concat [params] exprs))) (defn call-stmfunc [fn opts args statenext] (let [stm (first args) @@ -166,7 +166,7 @@ args (if (:pass-next-state opts) (concat args [statenext]) args) result (apply fn args) stm (if (:returns-value opts) (goto stm (state stm) result) (or result stm)) - stm (if (:advances opts) (goto stm statenext (value stm)))] + stm (if (:advances opts) (goto stm statenext (value stm)) stm)] stm)) (defn- handler-matches [stm handler event]