var-util.scm 529 B

123456789101112131415161718192021222324
  1. ; Part of Scheme 48 1.9. See file COPYING for notices and license.
  2. ; Authors: Richard Kelsey, Jonathan Rees
  3. (define (number-of-required-args formals)
  4. (do ((l formals (cdr l))
  5. (i 0 (+ i 1)))
  6. ((not (pair? l)) i)))
  7. (define (n-ary? formals)
  8. (cond ((null? formals) #f)
  9. ((pair? formals) (n-ary? (cdr formals)))
  10. (else #t)))
  11. (define (normalize-formals formals)
  12. (cond ((null? formals)
  13. '())
  14. ((pair? formals)
  15. (cons (car formals)
  16. (normalize-formals (cdr formals))))
  17. (else
  18. (list formals))))