'apply' causes 'function' to be evaluated with 'args' as the parameters. 'apply' returns the result of 'function'. 'args' must be in the form of a list.
(defun my-add (x y) ; create MY-ADD function
(print "my add")
(+ x y))
(my-add 1 2) ; prints "my add" returns 3
(apply 'my-add '(2 4)) ; prints "my add" returns 6
(apply 'my-add 1 2) ; error: bad argument type
(apply 'my-add '(1 2 3)) ; error: too many arguments
(apply (function +) '(9 10)) ; returns 19
(apply '+ '(4 6)) ; returns 10
(apply 'print '("hello there")) ; prints/returns "hello there"
(apply 'print "hello there") ; error: bad argument type
Note: When using 'apply' to cause the evaluation of a system
function, you can use the quoted name of the function [like 'print in
the examples]. You can also use the actual function [like
See the