Path: utzoo!mnetor!uunet!mcvax!ukc!its63b!aiva!jeff From: jeff@aiva.ed.ac.uk (Jeff Dalton) Newsgroups: comp.lang.misc Subject: Re: Multiple values Message-ID: <313@aiva.ed.ac.uk> Date: 31 Mar 88 22:47:38 GMT References: <12176@brl-adm.ARPA> <1988Mar11.215238.976@utzoo.uucp> <719@l.cc.purdue.edu> <10763@mimsy.UUCP> <3177@haddock.ISC.COM> <18580@think.UUCP> <8121@sol.ARPA> Reply-To: jeff@uk.ac.ed.aiva (Jeff Dalton) Organization: Dept. of AI, Univ. of Edinburgh, UK Lines: 40 Gaynor@porthos asks :How would Scheme's continuations fit into the area of multiple :return values? In article <8121@sol.ARPA> quiroz@cs.rochester.edu (Cesar Quiroz) writes: >In a capsule: >1- Returning == Calling a continuation >so >2- Returning multiple values == Calling a continuation with multiple >arguments. >I believe Scheme doesn't have this class of continuations. (Scheme's >continuations take only one argument). However, that this modification >is possible has been known for a long time [...], so I wouldn't be >surprised if at least one implementation has supported multiple values. T does more or less what you suggest. You can write (receive-values receiver sender) to call receiver with the values returned by sender. Sender should be a "thunk" that returns the right number of values when called. Return is used to return multiple values. So (receive-values (lambda (a b c) (list a b c)) (lambda () (return 1 2 3))) => (1 2 3) Then, (reveive (*) *) == (receive-values (lambda (*) *) (lambda () )) Jeff Dalton, JANET: J.Dalton@uk.ac.ed AI Applications Institute, ARPA: J.Dalton%uk.ac.ed@nss.cs.ucl.ac.uk Edinburgh University. UUCP: ...!ukc!ed.ac.uk!J.Dalton