Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rochester!pt.cs.cmu.edu!theory.cs.cmu.edu!tsf From: tsf@theory.cs.cmu.edu (Timothy Freeman) Newsgroups: comp.lang.lisp Subject: Re: Multiple Return values in Common Lisp. Message-ID: <1004@theory.cs.cmu.edu> Date: Wed, 3-Dec-86 16:32:17 EST Article-I.D.: theory.1004 Posted: Wed Dec 3 16:32:17 1986 Date-Received: Wed, 3-Dec-86 22:26:34 EST References: <1560@sunybcs.UUCP> Organization: Carnegie-Mellon University, CS/RI Lines: 37 In article <1560@sunybcs.UUCP> geller@sunybcs.UUCP (James Geller) writes: >I don't consider myself a great expert on Common Lisp, but >it seems to me that the idea of "multiple return values" of >Common Lisp is ill conceived. ... > (defun perimeter (rectangle-name) > (+ (* (extent/1 rectangle-name) 2) > (* (extent/2 #*) 2))) > This can be written reasonably well in common lisp already as follows: (defun perimeter (rectangle-name) (multiple-value-bind (x y) (extent rectangle-name) (+ (* x 2) (* y 2)))) > (defun square-of-hard-to-get-number (argument) > (* (long-computation argument) > (long-computation #*))) > This can be written in common lisp as follows: (defun square-of-hard-to-get-number (argument) (let ((res (long-computation argument))) (* res res))) Using the proper binding constructs makes common lisp (or any other variety of lisp) much more pleasant to use. -- Tim Freeman Arpanet: tsf@theory.cs.cmu.edu -- Tim Freeman Arpanet: tsf@theory.cs.cmu.edu