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

Error with multiple-value-setq...



    Date: Thu 8 May 86 21:10:24-CDT
    From: Nat Ballou <AI.BALLOU@MCC.ARPA>

    Using Release 6.1, the following definition does not perform
    correctly when compiled:

      (defun foo (&aux a b) (multiple-value-setq (a b) (floor 3 2)) (list a b))

    The function returns (1 1) when interpreted, but returns (1 NIL)
    when compiled.  Multiple-value-setq is common lisp, however, the
    Zeta lisp form Multiple-value has the same problem.
      Nat Ballou
      MCC AI
    -------

The problem is not with multiple-value-setq it is with floor
and other numeric functions that return 2 values.
If I write the function:

(defun foo1 ()
   (floor 3 2))

The compiled and interpreted versions return one and two values respectively.

If foo3 and foo4 are defined:

(defun foo3 ()
  (let (a b)
    (multiple-value-setq (a b) 
       (foo4 3 4))
    (list a b)))

(defun foo4 (x y)
  (values y x))

Then you get the same result in both the interpreted and compiled versions.
-------