Menu ▾ ▴

#97 Setq with multiple arguments (Maxima)

open
nobody
Build (7)
5
2008-08-31
2008-08-31
No

According to Robert Dodier, "ABCL compile-file doesn't seem to like setq with multiple arguments. I worked around that by changing (setq a b c d) to (setq a b) (setq c d)."

Discussion

  • Anonymous

    Anonymous - 2008-08-31

    Logged In: YES
    user_id=2169408
    Originator: NO

    the "compile-file" bit was the trigger: From jvm.lisp, see this quote:

    (defun p1-setq (form)
    (unless (= (length form) 3)
    (error "Too many arguments for SETQ."))

    Ouch!

    I think that sould be (unless (and (oddp (length form)) (< (length form) 3)) ...)

     
  • Anonymous

    Anonymous - 2008-08-31

    Logged In: YES
    user_id=2169408
    Originator: NO

    Ah. but when looking at the precompiler, I see that the case should always be (= (length form) 3)...

    Do you have some other examples? This is what I have (which works for me):

    Armed Bear Common Lisp 0.0.10.20 (built Mon Sep 1 2008 00:53:00 --100)
    Java 1.5.0_16 Sun Microsystems Inc.
    Java HotSpot(TM) Client VM
    Low-level initialization completed in 0.609 seconds.
    Startup completed in 2.227 seconds.
    Type ":help" for a list of available commands.
    CL-USER(1): (defun f () (let (a c) (setq a 'b c 'd) (values a c)))
    F
    CL-USER(2): (f)
    B
    D
    CL-USER(3): (compile nil #'f)
    #<FUNCTION (LAMBDA ()) {466F1D}>
    NIL
    NIL
    CL-USER(4): (f)
    B
    D
    CL-USER(5):

     

Log in to post a comment.