I am trying to write a short script file with elisp for the first time which will serve me to install all the required packages that I use. Thus when I change from one computer to another, I can get all the basic tools that I use daily. My purpose here is to write some code in lisp that actually serves me.

My question is about (oddp) function. I can execute this in ielm. But when I try to run script from the terminal. It gives me :

Symbol’s function definition is void: oddp

I searched a little and found another function (symbol-function). If I understand correctly this function shows the real name of a function. For instance, a user defined function is actually a lambda function (described in gnu-emacs). For the oddp function it is cl-oddp function. And when I change oddp to cl-oddp script finally started to work properly.

I am wondering 2 things :

  1. Why renaming does not work ?
  2. If renaming does not work then why it is used?


p.s. I am using Aquamacs (Emacs 25.1.1)

1 Answer 1


If you load library cl.el then C-h f oddp tells you this:

oddp is an alias for cl-oddp in cl.el.

(oddp INTEGER)

Return t if INTEGER is odd.

This function does not change global state, including the match data.

oddp is defined as an alias defined in cl.el. But your error message tells you that oddp is not defined. This is because cl.el has not yet been loaded.

(symbol-function 'oddp) tells you that the function definition of oddp is cl-oddp, which is a symbol. That symbol acts (indirectly) as a function, if its symbol-function value gets defined. It gets defined as a function (an alias to a defined function) when library cl.el is loaded.

If you want to use oddp in your code then you can load library cl.el.

cl-oddp itself is defined in cl-lib.el (a smaller library than cl.el). You can just require cl-lib instead of cl, if you use cl-oddp in your code instead of oddp.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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