curry checks that a single argument is a procedure (notified by #1839)
This commit is contained in:
parent
48092bdc0c
commit
27ec348a62
|
@ -29,4 +29,4 @@
|
|||
(check-equal? ((((curry foldl) +) 0) '(1 2 3)) 6)
|
||||
|
||||
(check-exn exn:fail:contract? (λ () (curry 1 2)))
|
||||
; (check-exn exn:fail:contract? (λ () (curry 1)))
|
||||
(check-exn exn:fail:contract? (λ () (curry 1)))
|
||||
|
|
|
@ -75,9 +75,15 @@
|
|||
curried))))
|
||||
;; curry is itself curried -- if we get args then they're the first step
|
||||
(define curry
|
||||
(case-lambda [(f) (define (curried . args) (curry* f args '() '()))
|
||||
curried]
|
||||
[(f . args) (curry* f args '() '())]))
|
||||
(case-lambda
|
||||
[(f)
|
||||
(unless (procedure? f)
|
||||
(raise-argument-error (if right? 'curryr 'curry) "procedure?" f))
|
||||
(define (curried . args) (curry* f args '() '()))
|
||||
curried]
|
||||
[(f . args)
|
||||
(curry* f args '() '())]))
|
||||
|
||||
(make-keyword-procedure (lambda (kws kvs f . args) (curry* f args kws kvs))
|
||||
curry))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user