I can use the following code in Scheme:
It runs fine in Scheme:
Does Emacs Lisp evaluate expressions in a different manner than Scheme?
(define (a-plus-abs-b a b)
((if (> b 0) + -) a b))
It basically looks at whether b is positive or not, and accordingly selects the "+" or "-" operation to apply to the arguments a and b.It runs fine in Scheme:
(a-plus-abs-b 1 1)
;; 2
(a-plus-abs-b 1 -1)
;; 2
However, when I try to define the same procedure in Emacs Lisp, the code crashes:(defun a-plus-abs-b (a b)
((if (> b 0) + -) a b))
Why is this?Does Emacs Lisp evaluate expressions in a different manner than Scheme?