More simple Lisp functions not working -


I am trying to create a function that calculates the number of lists within a list (if (not (but not (Print "Case B") (print "Case A") (return- (return) from (return) test (+ 0 (test (CDR A))) (return-on test (+ 1 (Test (CDR A))))))

I do not know how Debugger works, so I tried some novice debugging with print statement. The above mentioned code is also not executed. I have no idea why. The original code, which works but answers incorrectly as follows:

  (defun test (a) (if (equal to zero) (return 0)) (if (not (but not List A) Return from exam (+ 0 (test (CDR A))) (return test (+ 1 (test (CDR A))))))  

Returning the number of components, whether lists or not. I do not know where I'm going wrong. There is another problem too, when I crash at any atom (Test 1) or test, Of course, you can not take a CD's of the atom, but what error can I check? What can I do to make this ridiculous job?

The first block does not work because the function "if" has the highest deals with 3 forms (status then Branch branch If you want some actions in a branch, you should wrap them with a proxy:

  (if (not (list (app) () () (print ("print" case) (+ 0 (Test (CDR A))) (Progee (print "Case B") (Return-On Test (+ 1 (Test (CDR A)))))  
< The problem is with the second one (list A) You should know that instead of the whole list is the list of the complete list (listp (car a)).

I do not know, the script you use are doing, Most of them are available as "conduits", and are not particularly necessary for "return-to", therefore, you can rewrite the job as follows:

< ;);;);;;;;;;;;;;;;;;;;;;;;;;;;;; (Print "case list") (+ 1 (test (CDR A))) (T; Fist element is not list (print "not case list") (test (CDR A)))); Avoid adding zero A Because it has no effect

Comments