Subject: Re: private variable
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 1999/09/17
Newsgroups: comp.lang.scheme
Message-ID: <7rso9n$6buqg@fido.engr.sgi.com>
Kalle Olavi Niemitalo  <tosi@stekt.oulu.fi> wrote:
+---------------
| How can I define a variable such that only two functions see it?
| ...is there a MULTIPLE-VALUE-DEFINE?
| 
| (multiple-value-define (grumble mumble)
|   (let ((planetary-pi 61))
|     (values (lambda (radius) (* radius planetary-pi))
| 	    (lambda (circumference) (/ circumference planetary-pi)))))
+---------------

MzScheme <URL:http://www.cs.rice.edu/CS/PLT/packages/mzscheme/>
(and thus also DrScheme and MrEd) has a "define-values" that does
exactly what you seem to want "multiple-value-define" to do:

    > (define-values (grumble mumble)
	(let ((planetary-pi 61))
	  (values (lambda (radius) (* radius planetary-pi))
		  (lambda (circumference) (/ circumference planetary-pi)))))
    > planetary-pi
    reference to undefined identifier: planetary-pi
    > (grumble 3)
    183
    > (mumble 6100)
    100
    > 


-Rob

-----
Rob Warnock, 8L-846		rpw3@sgi.com
Applied Networking		http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673
1600 Amphitheatre Pkwy.		FAX: 650-933-0511
Mountain View, CA  94043	PP-ASEL-IA