Stop array from creating global symbol

This commit is contained in:
Mike Cifelli 2018-02-10 12:27:23 -05:00
parent 76b1f987a2
commit 737502c4de
1 changed files with 8 additions and 10 deletions

View File

@ -14,9 +14,10 @@
(let* ((this (gensym)) (let* ((this (gensym))
(index-prefix (fuse this 'index)) (index-prefix (fuse this 'index))
(indices (call static :create-indices length)) (indices (call static :create-indices length))
(index-bindings (map (lambda (i) (list (fuse index-prefix i))) indices))) (index-bindings (map (lambda (i) `(,(fuse index-prefix i))) indices))
(scope `((,this) ,@index-bindings)))
`(let ,index-bindings `(let ,scope
(setq ,this (setq ,this
(dlambda (dlambda
(:get (i) (:get (i)
@ -31,13 +32,10 @@
,length) ,length)
(t () (t ()
((lambda (indices accumulator) ((lambda (length accumulator)
(if (null? indices) (if (< length 1)
accumulator accumulator
(recur (recur
(rest indices) (- length 1)
(cons (cons (call ,this :get (- length 1)) accumulator))))
(call ,this :get (first indices)) ,length nil))))))))
accumulator))))
(reverse ',indices)
nil))))))))