1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 23:00:22 +02:00

define* usage in boot-9

* module/ice-9/boot-9.scm (make-module, make-mutable-parameter): Use
  define*.
This commit is contained in:
Andy Wingo 2010-08-29 11:59:10 -07:00
parent a2220d7ea4
commit e9729cbb2c

View file

@ -1461,25 +1461,11 @@ If there is no handler at all, Guile prints an error and then exits."
;; Create a new module, perhaps with a particular size of obarray,
;; initial uses list, or binding procedure.
;;
(define make-module
(lambda args
(define (parse-arg index default)
(if (> (length args) index)
(list-ref args index)
default))
(define* (make-module #:optional (size 31) (uses '()) (binder #f))
(define %default-import-size
;; Typical number of imported bindings actually used by a module.
600)
(if (> (length args) 3)
(error "Too many args to make-module." args))
(let ((size (parse-arg 0 31))
(uses (parse-arg 1 '()))
(binder (parse-arg 2 #f)))
(if (not (integer? size))
(error "Illegal size to make-module." size))
(if (not (and (list? uses)
@ -1502,7 +1488,7 @@ If there is no handler at all, Guile prints an error and then exits."
;; itself.
(set-module-eval-closure! module (standard-eval-closure module))
module))))
module))
@ -3080,16 +3066,13 @@ module '(ice-9 q) '(make-q q-length))}."
;;; {Parameters}
;;;
(define make-mutable-parameter
(let ((make (lambda (fluid converter)
(lambda args
(if (null? args)
(fluid-ref fluid)
(fluid-set! fluid (converter (car args))))))))
(lambda* (init #:optional (converter identity))
(define* (make-mutable-parameter init #:optional (converter identity))
(let ((fluid (make-fluid)))
(fluid-set! fluid (converter init))
(make fluid converter)))))
(case-lambda
(() (fluid-ref fluid))
((val) (fluid-set! fluid (converter val))))))