🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #5400

Re: The need for D-scussion (was Re: D Wishlist)

#5400
From: Barry Margolin
Date: Wed, 30 Mar 1988 02:57
33 lines
1905 bytes
In article <Mar.28.12.43.35.1988.1511@porthos.rutgers.edu> gaynor@porthos.rutgers.edu (Silver) writes:
>barmar@think.COM (Barry Margolin) writes:
>> (setq z (multiple-value-bind (quotient remainder)
>> 	      (floor x y)
>> 	    (+ (* quotient quotient) (* remainder remainder))))
>  How would Scheme's
>continuations fit into the area of multiple return values?

Continuations would have to be extended to be able to take multiple
arguments.  In order to precisely duplicate Common Lisp multiple-value
semantics, the above MULTIPLE-VALUE-BIND would call FLOOR with a
continuation of

(lambda (continuation &optional quotient remainder &rest ignore)
  (continuation (+ (* quotient quotient) (* remainder remainder))))

(I'm using CL lambda-list syntax because I'm not very familiar with
Scheme syntax).  This duplicates the feature of allowing the function
to return a different number of values than those explicitly
requested, where extra values are ignored and values not provided are
defaulted to NIL.

(values ...) is then equivalent to (continuation ...) and (values-list
list) is (apply continuation list).

Converting the rest of the multiple-value forms is similarly
straightforward.

Barry Margolin
Thinking Machines Corp.

barmar@think.com
uunet!think!barmar
Technical Details
Message-ID: <18643@think.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!ima!think!barmar
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> <Mar.28.12.43.35.1988.1511@porthos.rutgers.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!ima!think!barmar
From: barmar@think.COM (Barry Margolin)
Newsgroups: comp.lang.misc
Subject: Re: The need for D-scussion (was Re: D Wishlist)
Message-ID: <18643@think.UUCP>
Date: 30 Mar 88 02:57:33 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> <Mar.28.12.43.35.1988.1511@porthos.rutgers.edu>
Sender: usenet@think.UUCP
Reply-To: barmar@fafnir.think.com.UUCP (Barry Margolin)
Organization: Thinking Machines Corporation, Cambridge, MA
Lines: 33