chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-janitors] #1002: define-values is overly restrictive


From: Chicken Trac
Subject: [Chicken-janitors] #1002: define-values is overly restrictive
Date: Fri, 29 Mar 2013 05:35:37 -0000

#1002: define-values is overly restrictive
-------------------------+--------------------------------------------------
 Reporter:  johnwcowan   |       Owner:         
     Type:  enhancement  |      Status:  new    
 Priority:  major        |   Milestone:  someday
Component:  unknown      |     Version:  4.8.x  
 Keywords:               |  
-------------------------+--------------------------------------------------
 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)))))
 }}}

-- 
Ticket URL: <http://bugs.call-cc.org/ticket/1002>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]