Wolf sheep works in tests
[clnl] / src / main / transpile.lisp
index 91af23a000d0d6208725416968e290ed5f98e19e..956b226eaea577f61fb3de51b4ac0417e8761a4d 100644 (file)
@@ -196,9 +196,12 @@ DESCRIPTION:
 (defprim :if :command (lambda (pred a) `(when ,pred ,@(make-command-block-inline a))))
 (defprim '(:ifelse :if-else)
  :command (lambda (pred a b)
-           `(if ,pred
-             ,@(make-command-block-inline a)
-             ,@(make-command-block-inline b))))
+           (let
+            ((then (make-command-block-inline a))
+             (else (make-command-block-inline b)))
+            `(if ,pred
+              ,@(if (= (length then) 1) then `((progn ,@then)))
+              ,@(if (= (length else) 1) else `((progn ,@else)))))))
 
 (defagentvalueprim :label)
 (defagentvalueprim :label-color)