I'm using Lisp in a Box (emacs + GC Lisp)
And i tried making a function which takes a number as argument, adds 1 to it if it's negative, and substracts 1 from it if it's positive.
(look)
(defun enlarge(x) (if (< x 0) (- x 1) nil) (if (> x 0) (+ x 1) nil) )Yes, i know, should have made everythin in one IF, but i wanted to have 2 separate IF's for strictly positive and strictly negative numbers (too see what happens if the user enters 0)
Nevertheless:
CL-USER> (enlarge 5) 6 CL-USER> (enlarge -3) NILThis is what i get. Why??
Thank you.
;;;Btw, is it worth learning LISP? I've started learning little bits from it,
and i've already found it to be absolutely charming !!!


Sign In
Create Account


Back to top









