unsea

1,定义和获取列表元素

(list 1 2 3)
(list :a 1 :b 3 :c 2)
(getf (list :a 1 :b 3) :b); output:3

2,定义简单的函数

(defun make-cd (title artist rating ripped)
    (list :title title :artist artist :rating rating :ripped ripped))

3,定义全局变量

(devar *db* nil)

4,向全局变量添加纪录

(defun add-record (cd)
    (push cd *db*))
(add-record (make-cd "night" "chopin" 7 t))

5,循环输出列表

(defun dump-db ()
    (dolist (cd *db*)
        (format t "~{~a: ~10t~a~%~}~%" cd)))

~a 消耗一个实参并美化出来 ~t 产生制表符  ~{和~}之间对列表循环操作 ~% 换行

6,待续~

分类:

技术点:

相关文章:

  • 2021-12-10
  • 2021-08-30
  • 2018-05-15
  • 2021-12-26
  • 2021-11-11
  • 2021-07-10
猜你喜欢
  • 2022-01-02
  • 2021-04-22
  • 2018-06-27
  • 2021-05-11
  • 2021-04-20
相关资源
相似解决方案