mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-12 15:27:36 +02:00
Do not require formals-type
This commit is contained in:
parent
55df97d215
commit
ae3f906d24
2 changed files with 11 additions and 12 deletions
|
@ -131,18 +131,17 @@
|
||||||
(else (pair->list args))))
|
(else (pair->list args))))
|
||||||
|
|
||||||
;; Take arguments for a lambda and pack them depending upon lambda type
|
;; Take arguments for a lambda and pack them depending upon lambda type
|
||||||
(define (pack-lambda-arguments formals-type formals args)
|
(define (pack-lambda-arguments formals args)
|
||||||
(case
|
(cond
|
||||||
formals-type
|
((symbol? formals)
|
||||||
((args:varargs)
|
|
||||||
(list args))
|
(list args))
|
||||||
((args:fixed-with-varargs)
|
((list? formals)
|
||||||
|
args)
|
||||||
|
(else
|
||||||
(let* ((num-req-args (length/obj formals))
|
(let* ((num-req-args (length/obj formals))
|
||||||
(areq (take args num-req-args))
|
(areq (take args num-req-args))
|
||||||
(aopt (list-tail args num-req-args)))
|
(aopt (list-tail args num-req-args)))
|
||||||
(append areq (list aopt))))
|
(append areq (list aopt))))))
|
||||||
(else
|
|
||||||
args)))
|
|
||||||
|
|
||||||
(define (length/obj l)
|
(define (length/obj l)
|
||||||
(let loop ((lis l)
|
(let loop ((lis l)
|
||||||
|
|
|
@ -482,13 +482,13 @@
|
||||||
(apply-primitive-procedure proc args))
|
(apply-primitive-procedure proc args))
|
||||||
((compound-procedure? proc)
|
((compound-procedure? proc)
|
||||||
((procedure-body proc)
|
((procedure-body proc)
|
||||||
|
(let ((
|
||||||
(env:extend-environment
|
(env:extend-environment
|
||||||
;; TODO: need to pass lambdas as a list (depending on type), and
|
|
||||||
;; split up args accordingly (create a list for varargs)
|
|
||||||
|
|
||||||
(formals->list
|
(formals->list
|
||||||
(procedure-parameters proc))
|
(procedure-parameters proc))
|
||||||
args
|
;(pack-lambda-arguments
|
||||||
|
;(procedure-parameters proc)
|
||||||
|
args ;)
|
||||||
(procedure-environment proc))))
|
(procedure-environment proc))))
|
||||||
((procedure? proc)
|
((procedure? proc)
|
||||||
(apply
|
(apply
|
||||||
|
|
Loading…
Add table
Reference in a new issue