emacs - How to define a function with a variable number of arguments? -
instead of this:
((lambda (a b) (apply '+ (list b))) 1 2)
it possible write in scheme:
((lambda args (apply '+ args)) 1 2)
now possible pass more 2 arguments function.
when try in emacs lisp error: invalid function.
how define function in emacs lisp?
in emacs lisp, can put &rest
in argument list of function, remaining arguments list:
(lambda (&rest args) (apply '+ args))
Comments
Post a Comment