http:^^www.cs.washington.edu^education^courses^415^prog2.solution.html
来自「This data set contains WWW-pages collect」· HTML 代码 · 共 34 行
HTML
34 行
Date: Mon, 02 Dec 1996 14:42:34 GMTServer: NCSA/1.4.2Content-type: text/html<HEADER><TITLE>CSE 415 Prog. Assignment 2 Solution</TITLE></HEADER><BODY><pre>Note that by simplifying the sub expressions into a1 and a2, we avoid theproblem of having to run the simplify algorithm multiple times.(defun simplify (e) (cond ((atom e) e) (t (let ((a1 (simplify (arg1 e))) (a2 (simplify (arg2 e)))) (cond ((equal (op e) '*) (cond ((equal a1 0) 0) ((equal a2 0) 0) ((equal a1 1) a2) ((equal a2 1) a1) (t `(* ,a1 ,a2)))) ((equal (op e) '+) (cond ((equal a1 0) a2) ((equal a2 0) a1) (t `(+ ,a1 ,a2)))) ((equal (op e) '-) (cond ((equal a2 0) a1) (t `(- ,a1 ,a2)))) ((equal (op e) 'expt) (cond ((equal a2 1) a1) (t `(expt ,a1 ,a2)))))))))where op arg1 and arg2 extract the first, second, and third elementsof a list.</body>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?