Last active
December 13, 2015 21:28
-
-
Save kaikai2/4977656 to your computer and use it in GitHub Desktop.
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
; http://acl.readthedocs.org/en/latest/zhCN/ch5-cn.html#chapter-5-exercises | |
; 5.7-c | |
; 定义一个接受一系列数字的函数,并在若且唯若每一对(pair)数字的差为一时,返回真,使用mapc 与 return。 | |
(defun linked-mapc (lst) | |
(mapc #'(lambda (x y) | |
(unless (diff-1 x y) | |
(return-from linked-mapc nil))) | |
lst (cdr lst)) | |
t) | |
(defun diff-1 (a b) | |
(or (eql a (+ b 1)) | |
(eql b (+ a 1)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment