From c896bf90c5b817486d73ae9f73e6f97586156ce1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Linus=20Bj=C3=B6rnstam?= <bjoli@users.noreply.github.com>
Date: Wed, 4 Nov 2020 11:56:41 +0100
Subject: [PATCH] Fix bug in accumulating in (chibi loop)

Accumulating has a bug that makes only lists supported, due to it ignoring the init value and always use the empty list. This fixes that.
---
 lib/chibi/loop/loop.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/chibi/loop/loop.scm b/lib/chibi/loop/loop.scm
index bdafc750..118199c1 100644
--- a/lib/chibi/loop/loop.scm
+++ b/lib/chibi/loop/loop.scm
@@ -368,14 +368,14 @@
      (accumulating (kons final i) ((var cursor) x) n . rest))
     ((accumulating (kons final init) ((var cursor) (expr (if check))) n . rest)
      (n ((tmp-kons kons))
-        ((cursor '() (if check (tmp-kons expr cursor) cursor)))
+        ((cursor init (if check (tmp-kons expr cursor) cursor)))
         ()
         ()
         ((var (final cursor)))
         . rest))
     ((accumulating (kons final init) ((var cursor) (expr)) n . rest)
      (n ((tmp-kons kons))
-        ((cursor '() (tmp-kons expr cursor)))
+        ((cursor init (tmp-kons expr cursor)))
         ()
         ()
         ((var (final cursor)))