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))))
|
||||
|
||||
;; Take arguments for a lambda and pack them depending upon lambda type
|
||||
(define (pack-lambda-arguments formals-type formals args)
|
||||
(case
|
||||
formals-type
|
||||
((args:varargs)
|
||||
(define (pack-lambda-arguments formals args)
|
||||
(cond
|
||||
((symbol? formals)
|
||||
(list args))
|
||||
((args:fixed-with-varargs)
|
||||
((list? formals)
|
||||
args)
|
||||
(else
|
||||
(let* ((num-req-args (length/obj formals))
|
||||
(areq (take args num-req-args))
|
||||
(aopt (list-tail args num-req-args)))
|
||||
(append areq (list aopt))))
|
||||
(else
|
||||
args)))
|
||||
(append areq (list aopt))))))
|
||||
|
||||
(define (length/obj l)
|
||||
(let loop ((lis l)
|
||||
|
|
|
@ -482,13 +482,13 @@
|
|||
(apply-primitive-procedure proc args))
|
||||
((compound-procedure? proc)
|
||||
((procedure-body proc)
|
||||
(let ((
|
||||
(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
|
||||
(procedure-parameters proc))
|
||||
args
|
||||
;(pack-lambda-arguments
|
||||
;(procedure-parameters proc)
|
||||
args ;)
|
||||
(procedure-environment proc))))
|
||||
((procedure? proc)
|
||||
(apply
|
||||
|
|
Loading…
Add table
Reference in a new issue