Last active
August 29, 2015 14:05
-
-
Save sysatom/5d0aa7b326a5e467f19f to your computer and use it in GitHub Desktop.
ACL ch1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;2. | |
(cons 'a '(b c)) | |
(cons 'a (cons 'b (cons 'c nil))) | |
(cons 'a (cons 'b '(c))) | |
;3. | |
(defun fourth_number (x) | |
(car (cdr (cdr (cdr x))))) | |
;4. | |
(defun max_number (x y) | |
(if (> x y) | |
x | |
y)) | |
;5. | |
(defun enigma (x) | |
(and (not (null x)) | |
(or (null (car x)) | |
(enigma (cdr x))))) | |
(defun mystery (x y) | |
(if (null y) | |
nil | |
(if (eql (car y) x) | |
0 | |
(let ((z (mystery x (cdr y)))) | |
(and z (+ z 1)))))) | |
;6. | |
(car (car (cdr '(a (b c) d)))) | |
(or 13 (/ 1 0)) | |
(apply #'list 1 nil) | |
;7. | |
(defun has_list (x) | |
(if (null x) | |
nil | |
(if (listp (car x)) | |
T | |
(has_list (cdr x))))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment