help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: if/else execution in elisp


From: ken
Subject: Re: if/else execution in elisp
Date: Sun, 20 Oct 2002 15:36:03 -0400 (EDT)

Thanks for the vote of confidence.  I was starting to doubt reality.  
Here's the bigger fragment:

(defun testo-func ()
  (setq 
   zlist '(2 65535 3)                   
   firsto (car zlist)
   segundo (car (cdr zlist))
   thirdo (cdr (cdr zlist)))

  (if (> segundo 44671)
      (setq firsto (+ 2 firsto)  segundo (- 44672 segundo))
    (setq firsto (+ 1 firsto) segundo (+ 20864 segundo))
    )
  (list firsto segundo thirdo)
  )

When I evaluate (test-func), I want to get (4 20863 3), but I'm getting
instead (4 -20863 (3)).  The hilarious part is that testo-func works 
just fine for a lot of setq'd values.  


I'm about to die laughing.  Please help it stop.


ken

-- 
AMD crashes?  See http://cleveland.lug.net/~ken/amd-problem/.

Spake Barry Margolin at 20:43 (UTC-0000) on Fri, 18 Oct 2002:

= In article <mailman.1034973328.14861.help-gnu-emacs@gnu.org>,
= ken  <ken@cleveland.lug.net> wrote:
= >This should be simple.  It is in every other language I've ever used.  
= >Here's an if/else:
= >
= >  (if (> lb 5)
= >      (setq hh (+ 2 hh)  lb (+ 4 lb))                ; if true
= >         (setq hh (+ 1 hh) lb (+ 3 lb))      ; if false
= >         )
= >
= >What I'm trying to do should be obvious.  If not:
= >
= >If lb is greater than 5, increment hh and lb by 2 and 4 respectively.
= >If not, increment hh and lb by 1 and 3 respectively.
= 
= It looks correct to me.  What's the problem you're having?
= 
= 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]