functionalform-清华大学资讯工程系.ppt

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
functionalform-清华大学资讯工程系.ppt

* * * * * * * * * * * * * * * * * * * * * * * * * * * Refer to p.78 * * * Refer to p.79 * Refer to p.84 * Refer to p.73 * Refer to p.78, 85 * * * * Refer to p.73, 78 * Refer to p.73, 78 * * * * * EQLI-GEN eqli-gen It takes two general lists; returns whether the two lists are equal (DEFUN eqli-gen (li1 li2) (COND ((ATOM li1) (EQ li1 li2)) ((ATOM li2) nil) ((NULL li1) (NULL li2)) ((NULL li2) nil) ((eqli-gen (CAR li1) (CAR li2)) (eqli-gen (CDR li1) (CDR li2))) (t nil))) Copied and altered from textbook “Concepts of Programming Languages” * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Arithmetic Functions +, -, *, /, ABS, SQRT, MOD, REMAINDER, MIN, MAX expression value 42 42 (+ 5 7) 12 (+ 5 7 8) 20 (- 15 7 2) 6 (- 24 (* 4 3)) 12 Copied and altered from textbook “Concepts of Programming Languages” EVAL, QUOTE EVAL A function that can evaluate any other functions An implementation of EVAL could serve as a LISP interpreter QUOTE It returns the parameter without evaluation QUOTE is required because the interpreter, i.e. EVAL, always evaluates the parameters. QUOTE is used to avoid parameter evaluation when it is not appropriate QUOTE can be abbreviated with the apostrophe prefix operator. (A B) is equivalent to (QUOTE (A B)) Copied and altered from textbook “Concepts of Programming Languages” expression return value (QUOTE A) A ‘A A ‘(A B C) (A B C) (CAR (A B C)) error (CAR ‘(A B C)) A (CAR (+ 5 7)) error (CAR ‘(+ 5 7)) + Copied and altered from textbook “Concepts of Programming Languages” List Functions: CAR, CDR CAR takes a list parameter; returns the first element of that list e.g., (CAR (A B C)) yields A (CAR ((A B) C D)) yields (A B) CDR takes a list parameter; returns the list after removing its first element e.g. (CDR (A B C)) yields (B C) (CDR ((A B) C D)) yields (C D) Copied and altered from textbook “Concepts of Programming Languages” The nami

文档评论(0)

zcbsj + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档