0

I am learning the Lisp programming language. I have written a simple program:

(defun abs(x)
  (cond ((> x 0) x)
        ((= x 0) 0)
        ((< x 0) (- x))))

(print (abs 5))

when I compile and run this code, i get the following warning:

WARNING: DEFUN/DEFMACRO(ABS): #<PACKAGE COMMON-LISP> is locked
         Ignore the lock and proceed
WARNING: DEFUN/DEFMACRO: redefining function ABS in /home/lisp/file.lisp, was defined in C

I didn't understand why is this warning given, what does it mean? can anybody explain it?

1
  • In addition to FrédéricHamidi's comment, note that there's already an abs function defined in Common Lisp. You can't redefine it. Either use a different package, or a different name (e.g., my-abs). Jul 10, 2015 at 15:15

1 Answer 1

0

You are trying to redefine an ANSI Common Lisp function abs and the system is warning you about it.

Please see "package locking" in the manual.

(You now owe me 1 zorkmid).

Not the answer you're looking for? Browse other questions tagged or ask your own question.