[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple values

This can't be the problem:
From:     GSB@MIT-ML
Date: Sun, 24 Aug 81 05:47:42 GMT
Original-Date: 08/24/81 01:47:42 EDT
Subject: Re: Multiple values
	Date: 22 August 1981 02:28-EDT
	From: Carl W. Hoffman <CWH at MIT-MC>
From: 	    LAMP@MIT-MC
Date: Wed, 20 Aug 81 22:01:15 GMT
Original-Date: 08/20/81 18:01:15 EDT
	    I've got a question about multiple values.
	    Do you know why  (multiple-value (a1 a2 a3)
			       (let ((s1 3) (s2 2) (s3 4))
			     (values (+ s1 s2) (+ s2 s3) (+ s1 s3))))
	    gives an error message?  I tried it in the lisp under
	    a macsyma.                 Evan	
	Can somebody answer this?  It seems fine to me.
    Seems fine to me too.  But the error message should be self-explanatory.
    It thinks it's doing you (the user) a favor by barfing that LET 
    MIGHT not return multiple values.  Cute, eh?  (LET is SYSP, after all,
    and we all know system functions don't return multiple values.)
The multiple-value checking *does* indeed "pass thru" LET  -- note the
winnitude of LAMP's example with a slightly different structure
  (defun LAMP () 
    (multiple-value (a1 a2 a3)
	(let ((s1 3) (s2 2) (s3 4))
	  (auxillary s1 s2 s3))))
  (defun auxillary (s1 s2 s3)
    (values (+ s1 s2) (+ s2 s3) (+ s1 s3)))
I believe that all that was losing was the one part of the tester
macroexpanded *before* checking for VALUES explicitly (as the other
part of the tester did).  I've fixed that now in the installed MLMAC
(version 91), and will make up a new MACLISP/COMPLR pronto  (a move
somewhat overdue anyway since XLISP has been around for several weeks.)