From 5d32d5288aad3dbb904ee47a504f1f38152e3daf Mon Sep 17 00:00:00 2001 From: "Elf M. Sternberg" Date: Mon, 2 May 2016 20:31:29 -0700 Subject: [PATCH] Needed a flat version. --- src/lists.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lists.coffee b/src/lists.coffee index 0e4a3cf..c65fbb9 100644 --- a/src/lists.coffee +++ b/src/lists.coffee @@ -48,16 +48,16 @@ _annotate = (ConsList) -> car = (c) -> c[0] cdr = (c) -> c[1] - vectorToList = (v, p) -> + vectorToList = (v, p, d = true) -> p = if p? then p else 0 if p >= v.length then return nil # Annoying, but since lists are represented as nested arrays, they # have to be intercepted first. The use of duck-typing here is # frustrating. item = if pairp(v[p]) then v[p] else - if vectorp(v[p]) then vectorToList(v[p]) else v[p] + if (d and vectorp(v[p])) then vectorToList(v[p]) else v[p] cons(item, vectorToList(v, p + 1)) - + list = (v...) -> ln = v.length (nl = (a) ->