Lisp 真是一门神奇的语言
我使用的学习资料:https://acl.readthedocs.io/en/latest/zhCN/
学习环境搭建过程:
sudo zypper in emacs
git clone -b release https://github.com/roswell/roswell.git
nano src/cmd-run.h
sh bootstrap
./configure
make -j$(nproc)
sudo make install
ros setup # sbcl-bin + quicklisp
ros install sly
echo '(load (expand-file-name "~/.roswell/helper.el"))' >> ~/.emacs
emacs
然后在 EMACS 中:
M-x sly
C-x 1
这样就可以进入 REPL 进行学习了😋
(用 nano 改的是这里:https://github.com/roswell/roswell/issues/604#issuecomment-3130222012)
我刚刚写的习题:
CL-USER> (defun listinlistd (ls)
(let ((result nil))
(do ((rest ls (cdr rest)))
((null rest) nil)
(setf result (or result (listp (car rest)))))
result))
LISTINLISTD
CL-USER> (defun listinlistr (ls)
(cond
((null ls) nil)
((listp (car ls)) t)
(t (listinlistr (cdr ls)))))
LISTINLISTR