newLISP Fan Club

Forum => Anything else we might add? => Topic started by: Dmi on November 16, 2005, 12:18:03 AM

Title: (apply case '(...))
Post by: Dmi on November 16, 2005, 12:18:03 AM
(eval '(case 1 (1 "a"))) => "a"
(apply case '(1 (1 "a"))) => nil

What is the difference?
Title:
Post by: Lutz on November 16, 2005, 05:41:26 AM
You can use 'apply' only on normal functions evaluating their arguments. In 'case' the parenthesized terms are never evaluated but broken up by 'case' directly to access the innerts. In LISP lingo functions which do not evaluate their arguments are called special functions or special forms because they do not follow the normal evaluation rules.



It is the same as doing:



(apply dotimes '((x 10) (print x))) => fails

;or

(apply setq '(x 10)) => fails



Lutz



ps: I realize this should be mentioned in the documentation of 'apply'
Title:
Post by: Dmi on November 16, 2005, 06:15:24 AM
Thanks!