Opened 12 years ago
Closed 10 years ago
#1002 closed enhancement (fixed)
define-values is overly restrictive
Reported by: | johnwcowan | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | someday |
Component: | unknown | Version: | 4.8.x |
Keywords: | Cc: | ||
Estimated difficulty: |
Description
Currently, define-values
requires that its lambda-list be a proper list of identifiers like (a b)
, whereas it should allow (a b . c)
and even a
, which are both valid lambda-lists.
The following definition achieves this:
(define-syntax define-values (syntax-rules () ((define-values () exp) (call-with-values (lambda () exp) (lambda () 'unspecified))) ((define-values (var . vars) exp) (begin (define var (call-with-values (lambda () exp) list)) (define-values vars (apply values (cdr var))) (define var (car var)))) ((define-values var exp) (define var (call-with-values (lambda () exp) list)))))
Change History (3)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Jeez, that's horrible!
A much simpler (I hope equally correct) version has been sent to chicken-hackers.
comment:3 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed by 25a9b9932014f8ff84825658c054a91e6c0630f3..136e0b4292aec0cb8c5c8f6c9860d22bc2261a1e136e0b4292aec0cb8c5c8f6c9860d22bc2261a1e
Note: See
TracTickets for help on using
tickets.
Here's the definition from R7RS: