[racket] Splicing `values' in-place

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Thu Jul 11 13:34:07 EDT 2013

Hi Laurent,

It is interesting to see the historical evolution of multiple values in
Scheme.
In June 1988 this proposal was posted:

http://groups.csail.mit.edu/mac/ftpdir/scheme-mail/HTML/rrrs-1988/msg00230.html

At the Snowbird meeting in July 1988 no concensus was found.

3.7. Add LAMBDA*. Not adopted. The main objection seemed to be that

this proposal requires a new kind of stored value (multiple values) that

either is not an expressed value or does not behave like other expressed

values.



> 3.8. Multiple return values. Not adopted. Debate centered on whether

returning a single "multiple value" should be equivalent to returning

that value normally. A secondary issue concerned whether extra return

values should be ignored or an error. We approached consensus on this.

After much debate it was decided to go on to other issues and let

Dybvig and Hanson discuss the matter in private. Their discussion

later that night led to a conclusion that we don't understand the

issues well enough to charge ahead with either proposal 3.7 or 3.8

or a variation.



> 3.9. Optional arguments. Not considered, as it was felt that this

would be a more controversial issue than proposal 3.8 on which we had

just spent a great deal of time.


The discussion went on on this thread:
http://groups.csail.mit.edu/mac/ftpdir/scheme-mail/HTML/rrrs-1989/msg00148.html
Scroll down on this page to see all entries:
http://groups.csail.mit.edu/mac/ftpdir/scheme-mail/HTML/rrrs-1989/threads.html

The discussion on multiple values pops up now and again. See for example
this
thread on comp.lang.scheme.
https://groups.google.com/d/msg/comp.lang.scheme/ty2YeqZibNI/VR21X6XP9-IJ

As for using multiple values in Racket, I use these lines
    (define-syntax defv (make-rename-transformer #'define-values))
    (define-syntax defm (make-rename-transformer #'match-define))
    (define-syntax def  (make-rename-transformer #'define))
to make local definitions short.

A little function to make a rotation matrix:

    (define (rotmat/rad θ)
      (defv (cosθ sinθ) (cos&sin θ))
      (mat cosθ (- sinθ) sinθ cosθ))

-- 
Jens Axel Søgaard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130711/2b1613d5/attachment.html>

Posted on the users mailing list.