mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Cleanup
This commit is contained in:
parent
a91c406020
commit
2499f60730
2 changed files with 12 additions and 4 deletions
|
@ -9,7 +9,6 @@
|
|||
(define-library (scheme cyclone util)
|
||||
(import (scheme base)
|
||||
(scheme char))
|
||||
; TODO: really need export-all for these cyclone libs!!
|
||||
(export
|
||||
;; Code analysis
|
||||
tagged-list?
|
||||
|
@ -17,6 +16,7 @@
|
|||
begin?
|
||||
lambda?
|
||||
pair->list
|
||||
formals->list
|
||||
lambda-formals->list
|
||||
lambda-varargs?
|
||||
lambda->formals
|
||||
|
@ -96,7 +96,7 @@
|
|||
; (or (symbol? (lambda->formals exp))
|
||||
; (and (pair? (lambda->formals exp))
|
||||
; (not (list? (lambda->formals exp)))))))
|
||||
; Alternate definition:
|
||||
; Alternate definition, works even if exp is not a lambda (IE, an AST):
|
||||
(define (lambda-varargs? exp)
|
||||
(let ((type (lambda-formals-type exp)))
|
||||
(or (equal? type 'args:varargs)
|
||||
|
@ -119,6 +119,14 @@
|
|||
(pair->list args)))
|
||||
(lambda->formals exp)))
|
||||
|
||||
;; object -> list
|
||||
;; Accept only args instead of a whole lambda
|
||||
(define (formals->list args)
|
||||
(cond
|
||||
((symbol? args) (list args))
|
||||
((list? args) args)
|
||||
(else (pair->list args))))
|
||||
|
||||
; char->natural : char -> natural
|
||||
(define (char->natural c)
|
||||
(let ((i (char->integer c)))
|
||||
|
|
|
@ -486,8 +486,8 @@
|
|||
;; TODO: need to pass lambdas as a list (depending on type), and
|
||||
;; split up args accordingly (create a list for varargs)
|
||||
|
||||
(lambda-formals->list
|
||||
`(lambda ,(procedure-parameters proc) #f))
|
||||
(formals->list
|
||||
(procedure-parameters proc))
|
||||
args
|
||||
(procedure-environment proc))))
|
||||
((procedure? proc)
|
||||
|
|
Loading…
Add table
Reference in a new issue