mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-12 15:27:36 +02:00
Prevent "too many arguments" errors
Use folds instead of apply to prevent errors with too many arguments passed.
This commit is contained in:
parent
9720387420
commit
abdce5d978
1 changed files with 16 additions and 15 deletions
|
@ -222,25 +222,26 @@
|
||||||
(define (c:num-args c-tuple) (caddr c-tuple))
|
(define (c:num-args c-tuple) (caddr c-tuple))
|
||||||
|
|
||||||
(define (c:allocs->str c-allocs . prefix)
|
(define (c:allocs->str c-allocs . prefix)
|
||||||
(apply
|
(foldr
|
||||||
string-append
|
(lambda (x y)
|
||||||
(map
|
(string-append
|
||||||
(lambda (c)
|
(string-append
|
||||||
(string-append
|
|
||||||
(if (null? prefix)
|
(if (null? prefix)
|
||||||
""
|
""
|
||||||
(car prefix))
|
(car prefix))
|
||||||
c
|
x
|
||||||
"\n"))
|
"\n")
|
||||||
c-allocs)))
|
y))
|
||||||
|
""
|
||||||
|
c-allocs))
|
||||||
|
|
||||||
(define (c:allocs->str2 c-allocs prefix suffix)
|
(define (c:allocs->str2 c-allocs prefix suffix)
|
||||||
(apply
|
(foldr
|
||||||
string-append
|
(lambda (x y)
|
||||||
(map
|
(string-append
|
||||||
(lambda (c)
|
(string-append prefix x suffix)))
|
||||||
(string-append prefix c suffix))
|
""
|
||||||
c-allocs)))
|
c-allocs))
|
||||||
|
|
||||||
(define (c:append cp1 cp2)
|
(define (c:append cp1 cp2)
|
||||||
(c-code/vars
|
(c-code/vars
|
||||||
|
@ -1280,7 +1281,7 @@
|
||||||
|
|
||||||
;; Get top-level string
|
;; Get top-level string
|
||||||
(set! compiled-program
|
(set! compiled-program
|
||||||
(apply string-append (reverse compiled-program-lst)))
|
(foldr string-append "" (reverse compiled-program-lst)))
|
||||||
|
|
||||||
(emit-c-arity-macros 0)
|
(emit-c-arity-macros 0)
|
||||||
(emit "#include \"cyclone/types.h\"")
|
(emit "#include \"cyclone/types.h\"")
|
||||||
|
|
Loading…
Add table
Reference in a new issue