Posted February 13, 20169 yr little lisp-problem/question with &optionel / &key... here are two test-programs to explore keyword and optional paramters this test-program works (defun test1 (liste add &key (add-on/off)) (loop for i in liste when (equal add-on/off 'on) collect (+ i add) else collect i)) (test1 '(1 2 3 4 5) 100 :add-on/off 'on) this version with &optional don't work... why? (defun test2 (liste add &optional (x 10) &key (add-on/off)) (loop for i in liste when (equal add-on/off 'on) collect (+ i add x) else collect i)) (test2 '(1 2 3 4 5) 100 :add-on/off 'on) > Error: While compiling test2 : > Bad lambda list : (liste add &key add-on/off &optional (x 10)), in process Listener-1(7). thanx for help andré
Create an account or sign in to comment