在好例子网,分享、交流、成长!
您当前所在位置:首页Others 开发实例Lisp → 《Lisp 语言》

《Lisp 语言》

Lisp

下载此实例
  • 开发语言:Others
  • 实例大小:4.21M
  • 下载次数:18
  • 浏览次数:75
  • 发布时间:2023-01-16
  • 实例类别:Lisp
  • 发 布 人:老刘
  • 文件格式:.pdf
  • 所需积分:0
 相关标签:

实例介绍

【实例简介】《Lisp 语言》

【实例截图】

【核心代码】

目录
Lisp 概述 _____________________________________________________________________________1
第一章 Lisp 语言快速入门 ______________________________________________________________3
1.1 Lisp 的求值与数据类型 __________________________________________________________4
1.2 Lisp 的 7 个基本运算符 __________________________________________________________5
1.2.1 quote ____________________________________________________________________5
1.2.2 atom ____________________________________________________________________5
1.2.3 eq ______________________________________________________________________5
1.2.4 car 和 cdr ________________________________________________________________6
1.2.5 cons_____________________________________________________________________6
1.2.6 cond ____________________________________________________________________6
1.3 变量与赋值 _____________________________________________________________________7
1.4 输入输出 _______________________________________________________________________8
1.5 条件 __________________________________________________________________________10
1.6 循环 __________________________________________________________________________12
1.7 函数 __________________________________________________________________________13
1.7.1 defun _________________________________________________________________13
1.7.2 几个常用函数及其定义 ___________________________________________________14
1.7.3 函数对象 _______________________________________________________________15
1.7.4 lambda 表达式 __________________________________________________________17
1.8 递归 __________________________________________________________________________17
1.9 小结 __________________________________________________________________________19
1.10 习题 _________________________________________________________________________19
第二章 表 (list) _______________________________________________________________________21
2.1 cons ___________________________________________________________________________21
2.2 表操作的一些重要函数 __________________________________________________________25
2.2.1 APPEND 函数 __________________________________________________________26
2.2.2 CONS , LIST 和 APPEND________________________________________________27
2.2.3 REVERSE 函数 _________________________________________________________28
 ii
2.2.4 NTH 函数和 NTHCDR 函数 ______________________________________________29
2.2.5 LAST 函数 ____________________________________________________________30
2.2.6 REMOVE 函数 _________________________________________________________30
2.3 函数映像 _______________________________________________________________________31
2.4 树 ____________________________________________________________________________32
2.5 集合 __________________________________________________________________________32
2.5.1 MEMBER 函数 _________________________________________________________32
2.5.2 INTERSECTION 函数 ___________________________________________________33
2.5.3 UNION 函数 ___________________________________________________________34
2.5.4 SET-DIFFERENCE 函数 _________________________________________________34
2.5.6 SUBSETP 函数 _________________________________________________________34
2.5.7 关键词参数 ____________________________________________________________35
2.5.8 集合应用实例 __________________________________________________________36
上机练习 __________________________________________________________________38
2.6 关联表 (assoc-list) _______________________________________________________________38
2.6.1 ASSOC 函数 ___________________________________________________________39
2.6.2 RASSOC 函数 __________________________________________________________39
2.6.3 使用表格编程 ___________________________________________________________40
上机练习 __________________________________________________________________42
2.7 序列 (sequence) _________________________________________________________________42
2.8 堆栈 __________________________________________________________________________45
2.9 相等性 ________________________________________________________________________46
2.10 垃圾 (garbage) 收集 _____________________________________________________________48
2.11 小结 _________________________________________________________________________49
2.12 习题 _________________________________________________________________________49
第三章 其它数据结构 _________________________________________________________________51
3.1 向量与数组 ____________________________________________________________________51
3.1.1 向量 ___________________________________________________________________51
3.1.2 数组 ___________________________________________________________________53
3.2 字符与字符串向量 ______________________________________________________________56
3.2.1 和字符串 ___________________________________________________________56
3.2.2 字符串函数 _____________________________________________________________59
 iii
3.2.3 转换 ___________________________________________________________________61
3.3 结构与类型系统 ( Structures and The Type System ) _________________________________62
3.3.1 TYPEP 和 TYPE-OF____________________________________________________63
3.3.2 定义结构 (STRUCTURE) __________________________________________________64
3.3.3 访问与修改 _____________________________________________________65
3.3.4 的打印显示 _______________________________________________________67
3.3.5 变量相等性 _______________________________________________________69
3.3.6 结构体继承 _____________________________________________________________70
3.4 哈希表 (Hash Table) _____________________________________________________________71
3.5 一些应用 _____________________________________________________________________73
3.5.1 二分法 _________________________________________________________________73
3.5.2 字符串分析 _____________________________________________________________75
3.5.3 二叉搜索树 _____________________________________________________________76
3.6 小结 _________________________________________________________________________80
3.7 习题 _________________________________________________________________________80
1 ________________________________________________________________81
上机练习 2 ________________________________________________________________82
阅读材料 : 空间 ( room ) ____________________________________________________________85
第四章 求值与赋值 ___________________________________________________________________87
4.1 EVAL__________________________________________________________________________87
4.1.1 求值规则 _______________________________________________________________87
4.1.2 EVAL 与 APPLY _________________________________________________________89
4.2 赋值 __________________________________________________________________________90
4.2.1 修改全局变量 ___________________________________________________________90
4.2.1.1 INCF 和 DECF 宏 ___________________________________________________91
4.2.1.2 PUSH 宏和 POP 宏 __________________________________________________91
4.2.2 修改局部变量 ___________________________________________________________92
4.2.3 广义变量 _______________________________________________________________94
4.2.4 链表上的破坏性操作 _____________________________________________________96
4.2.4.1 NCONC ___________________________________________________________96
4.2.4.2 NSUBST___________________________________________________________98
4.2.4.3 破坏性操作的应用 __________________________________________________99
4.3 变 量 及 其 副 作 用 _______________________________________________________________100
 iv
4.3.1 局部变量和全局变量 ___________________________________________________100
4.3.2 用宏 SETF 为变量赋值 _________________________________________________101
4.3.2.1 SETF 宏 __________________________________________________________101
4.3.2.2 SETQ 和 SET 宏 ___________________________________________________102
4.3.3 副作用 _______________________________________________________________103
4.3.4 LET_________________________________________________________104
4.3.5 特殊函数 LET*________________________________________________________105
4.3.6 副作用可能导致漏洞 ___________________________________________________107
4.3.7 符号和值单元 _________________________________________________________109
4.3.8 区分全局变量和局部变量 _______________________________________________110
4.3.9* 绑定,作用域和赋值 __________________________________________________112
4.4 小结 _________________________________________________________________________113
4.5 习题 _________________________________________________________________________113
上机练习 _________________________________________________________________114
1: 用 Lisp 写 Lisp 解释器 EVAL ____________________________________________115
阅读材料 2 : DOCUMENTATION 和 APROPOS _____________________________________117
第五章 块 、 循环与中断控制 __________________________________________________________120
5.1 基本的块操作符 ________________________________________________________________120
5.2 其它语句组操作符 ______________________________________________________________122
5.2.1 let 和 let* ______________________________________________________________122
5.2.2 when , unless , cond 和 case_______________________________________________123
5.3 循环控制 _____________________________________________________________________125
5.3.1 DOTIMES 和 DOLIST _________________________________________________125
5.3.2 退出循环体 ____________________________________________________________125
5.3.3 用赋值构建结果 ________________________________________________________127
5.3.4 Do 和 Do*______________________________________________________________127
5.4 多值控制 _____________________________________________________________________128
5.5 异常中断 _____________________________________________________________________130
5 .6 小结 _______________________________________________________________________132
5.7 练习 ________________________________________________________________________133
上机练习 : ________________________________________________________________133
阅 读 材 料 : BREAK 和 ERROR______________________________________________________134
 v
第六章 条件语句 ____________________________________________________________________137
6.1 IF 语句 ______________________________________________________________________137
6.2 COND ______________________________________________________________________139
6.3 AND 和 OR __________________________________________________________________143
6.4 建立复杂的谓词表达式 ________________________________________________________145
6.5 条件互换 ____________________________________________________________________147
6.6 布尔函数 ____________________________________________________________________149
6.7 小结 ________________________________________________________________________152
6.8 习题 ________________________________________________________________________152
阅读材料 : Lisp 工具包 STEP _______________________________________________________155
第七章 函数与输入输出 ______________________________________________________________157
7.1 全局 _____________________________________________________________________157
7.2 局部函数 _____________________________________________________________________158
7.3 参数表 ________________________________________________________________________158
7.4 函数闭集 _____________________________________________________________________160
7.5 动态作用域 ___________________________________________________________________166
7.6 函数编译 ______________________________________________________________________168
7.7 输出 流 ___________________________________________________________________169
7.8 输入 _________________________________________________________________________170
7.9 输出 _________________________________________________________________________172
7.10 小结 ________________________________________________________________________173
7.11 习题 ________________________________________________________________________173
1 : Lifetime and Visibility __________________________________________________174
阅读材料 2 : Scope and Extent ______________________________________________________176
第八章 递归 _______________________________________________________________________182
8.1 Martin 和龙 __________________________________________________________________182
8.2 搜索奇数的函数 ______________________________________________________________183
8.3 MARTIN 再 次 拜 访 龙 _________________________________________________________186
 vi
8.4 阶乘函数的实例 ______________________________________________________________187
8.5 龙的梦 _______________________________________________________________________188
8.6 计算面包片数的递归函数 ______________________________________________________189
8.7 递归的三个法则 ______________________________________________________________190
8.8 Martin 发现无穷递归 __________________________________________________________191
8.9 Lisp 中的无穷递归 ____________________________________________________________192
8.10 递归模板 ___________________________________________________________________194
8.10.1 双测试尾递归 _________________________________________________________194
8.10.2 单测试尾递归 ________________________________________________________195
8.10.3 增强的递归 ___________________________________________________________196
8.11 基本模板的变形 _____________________________________________________________196
8.11.1 cons 列表递归 _________________________________________________________196
8.11.2 多个变量的同时递归 __________________________________________________197
8.11.3 条件增强 _____________________________________________________________198
8.11.4 多重递归 _____________________________________________________________200
8.11.5 树和 CAR/CDR 递归 ___________________________________________________202
8.12 转换为尾递归 ________________________________________________________________203
8.13 小结 ________________________________________________________________________206
8.14 习题 ________________________________________________________________________206
上机练习 _________________________________________________________________209
阅读材料 : 描述 ( DESCRIBE ) 与检查 ( INSPECT ) __________________________________210
第九章 数与符号 _________________________________________________________________213
9.1 类型 、 转换 、 运算函数与比较 _______________________________________________213
9.2 数的表示 _____________________________________________________________________216
9.3 符号 _________________________________________________________________________217
9.4 属性表 ________________________________________________________________________218
9.5 包 (package) 与符号 _____________________________________________________________220
9.6 小结 _________________________________________________________________________221
9.7 习题 __________________________________________________________________________222
 vii
第十章 宏与编译 ____________________________________________________________________223
10.1 宏速记与展开 ________________________________________________________________223
10.2 宏定义 ______________________________________________________________________225
10.3 BACKQUOTE( 反引号 ) _______________________________________________________228
10.4 宏设计 ______________________________________________________________________231
10.5 ________________________________________________________________________234
10.6 编译和宏展开 ________________________________________________________________235
10.7 结构拆分的宏实例 ____________________________________________________________236
10.8 宏与词汇作用域 ______________________________________________________________237
10.9 动态作用域 __________________________________________________________________239
10.10 小结 _______________________________________________________________________242
10.11 习题 _______________________________________________________________________243
阅读材料 : PPMX ________________________________________________________________243
第十一章 面向对象的 Common Lisp (CLOS)____________________________________________245
11.1 类与层次封锁 ________________________________________________________________245
11.2 从结构到类 __________________________________________________________________246
11.3 类与对象定义 ________________________________________________________________247
11.3.1 类的定义与对象创建 ____________________________________________________247
11.3.2 访问函数 _____________________________________________________________248
11.3.3 其他可选参数 _________________________________________________________249
11.4 继承 ________________________________________________________________________251
11.5 通用函数 ____________________________________________________________________252
11.5.1 方法定义 _____________________________________________________________253
11.5.2 参数特定化 ___________________________________________________________253
11.5.3 最当方法与类优先级表 _________________________________________________256
11.6 方法合并 ____________________________________________________________________259
11.6.1 标准方法合并 __________________________________________________________259
11.6.2 操作符方法合并 _______________________________________________________262
11.7 封装 ________________________________________________________________________265
 viii
11.8 MOP 和面向对象技术的两种模型 ______________________________________________265
11.9 小结 ________________________________________________________________________267
11.10 习题 _______________________________________________________________________267
第十二章 Allegro Common Lisp 实践 __________________________________________________269
12.1 简述 Allegro CL _____________________________________________________________269
12.2 Allegro CL3.02 基本使用 ______________________________________________________270
12.2.1 Toploop_______________________________________________________________271
12.2.2 括号匹配、文件装载与编译 _____________________________________________272
12.3 可视化界面制作 _____________________________________________________________274
12.3.1 交互界面类与构造 _____________________________________________________275
12.3.2 界面属性 _____________________________________________________________275
12.3.3 工具栏与菜单栏 _______________________________________________________276
12.3.4 弹出对话框 ___________________________________________________________278
12.3.5 鼠标事件 _____________________________________________________________281
12.4 制作象文件 _________________________________________________________________283
12.5 命题逻辑相关方法的 LISP 实现 _________________________________________________285
12.5.1 真值表 _______________________________________________________________285
12.5.2 主范式与公式等价性 ___________________________________________________288
12.5.3 归结证明 _____________________________________________________________295
12.6 小结 ________________________________________________________________________304

标签:

实例下载地址

《Lisp 语言》

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警