Search code examples
elisp

elisp Invalid function: (quote a)


As i am newbie for elisp language, I code the below code for elisp.

when i eval that, it is failed.

echo area show the error "our-member: Invalid function: (quote a)"

Also i am confusing about the basic element for lisp language.

is that 'a not a obj or a list ? And what is the list definition due to i dont find that on wiki and google.

(defun our-member(obj list)
  (if (nil list)
      nil
    (if (eql (car list) obj)
        list
      (our-member obj (cdr list)))))

(our-member('a '(a b c)))

Solution

  • A function call in Lisp looks like (function arguments) not (function (arguments)). The latter, you'll recognize, is attempting to run arguments as a function as well.

    Emacs comes with excellent documentation; Lisp's data types are documented at http://www.gnu.org/software/emacs/manual/html_node/elisp/Lisp-Data-Types.html but maybe start with the gentler introduction, which also covers basic syntax; https://www.gnu.org/software/emacs/manual/eintr.html