Difference between LET and LET* in Common LISP
 
LET
 
Parallel binding which means the bindings come to life at the same time and they do not shadow each other. The values are effective inside LET and they are undefined outside LET. Just like local variables.
 
LET binds variables all at the same time.
 
None of the variables defined in the LET have a value after lisp has finished evaluating the form.
 
Example 1:
 
Input:
* (setf x 'outside)
* (let ((x 'inside)
        (y x))
        (list x y))
 
Output:
(INSIDE OUTSIDE)
 
Example 2:
 
Input:
(let ((a 3)
      (b 4)
      (c 5))
     (* (+ a b)c))
 
Output:
35
 
Example 3:
 
Input:
(setq a 10)
(let ((a 3)
      (m a))
     (+m a))
 
Output:
13
 
 
 
 
LET*
 
Sequential binding.
 
Example:
 
Input:
* (setf x 'outside)
* (let* ((x 'inside)
         (y x))
         (list x y))
 
Output:
(INSIDE INSIDE)
 
 
 
It always more efficient to use LET than LET*. Since the program can run parallel when using LET.

Difference between LET and LET* in Common LISP的更多相关文章

  1. ANSI Common Lisp Practice - My Answers - Chatper - 3

    Ok, Go ahead. 1 (a) (b) (c) (d) 2 注:union 在 Common Lisp 中的作用就是求两个集合的并集.但是这有一个前提,即给的两个列表已经满足集合的属性了.具体 ...

  2. 搭建fedora开发环境 common lisp, c++, go

    第三方软件库: http://download1.rpmfusion.org/free/fedora/releases/25/Everything/x86_64/os/repoview/index.h ...

  3. Common Lisp编译程序的小技巧

    这几天开始玩Common Lisp,遇上了一个有意思的问题,CL一般是解释运行,也有实现可以编译生成字节码(fas文件).我正在用的两种CL实现是SBCL和CLISP,前者是我从<实用Commo ...

  4. scheme和common lisp 区别

    Scheme and Common Lisp use different names for some of the basic system functions. Many Lisp program ...

  5. slime+sbcl for common lisp

    sudo apt-get install slime audo apt-get install sbcl ;;sbcl+slime for common lisp ;;sudo apt-get ins ...

  6. Common Lisp 编译器IDE环境搭建

    搭建Common Lisp编程环境的方法有很多种,这里我使用的是最常见的一种:SBCL + Emacs + SLIME. SBCL是Steel Bank Common Lisp的简称,它是Common ...

  7. 推动Common Lisp的实际应用

    推动Common Lisp的实际应用 推动Common Lisp的实际应用

  8. Common Lisp第三方库介绍 | (R "think-of-lisper" 'Albertlee)

    Common Lisp第三方库介绍 | (R "think-of-lisper" 'Albertlee) Common Lisp第三方库介绍 一个丰富且高质量的开发库集合,对于实际 ...

  9. Lisp: Common Lisp, Racket, Clojure, Emacs Lisp - Hyperpolyglot

    Lisp: Common Lisp, Racket, Clojure, Emacs Lisp - Hyperpolyglot Lisp: Common Lisp, Racket, Clojure, E ...

随机推荐

  1. 改变tableView索引颜色

        _tableView.sectionIndexBackgroundColor = [UIColor clearColor];     _tableView.sectionIndexColor ...

  2. Linux sort 多字段分组排序

    常用参数: -t: 指定分隔符 -k: 指定域 -u: 去除重复行 -n: 以数值排序 -r: 降序排序 (sort默认的排序方式是升序) -o: 结果重定向输出到文件 1.源文件: # cat hh ...

  3. ios9关闭系统自动更新

    链接:https://www.zhihu.com/question/37297197/answer/104363172 https://www.zhihu.com/question/37297197/ ...

  4. 解决Maven中OutOfMemory错误

    当Maven项目很大,或者你运行诸如 mvn site 这样的命令的时候,maven运行需要很大的内存,在默认配置下,就可能遇到java的堆溢出.如:   [INFO] Building jar: / ...

  5. Swift的排序算法总结

    下面让我们一起来见识一下swift中基于Array的扩展的冒泡排序,选择排序和快速排序吧. 1.冒泡排序 冒泡排序再基础不过了,这里就不再讲其原理了,实在不会可以看下百度百科冒泡排序 既然冒泡排序避免 ...

  6. 【笔记】select2的使用

    <script src="~/Scripts/jquery-1.10.2.js"></script> <script src="~/Cont ...

  7. node-webkit教程(11)Platform Service之shell

    node-webkit教程(11)Platform Service之shell 文/玄魂 目录 node-webkit教程(10)Platform Service之shell 前言 11.1  She ...

  8. [WinAPI] API 12 [获取程序所在的目录、程序模块路径,获取和设置当前目录]

    Windows系统提供一组API实现对程序运行时相关目录的获取和设置.用户可以使用GetCurrentDirectory和SetCurrentDirectory获取程序的当前目录,获取模块的路径使用G ...

  9. 无线客户端框架设计(2):项目结构的设计(iOS篇)

    本文附带源码:YoungHeart-Chapter-02.zip 在设计任何一个框架之前,都应规划好项目结构. 假定Git作为我们的项目管理工具.我们要建立两个仓库,一个用于存放我们的框架,另一个用于 ...

  10. JavaScript简介及基础知识(1)

    1.JavaScript是什么—它是个脚本语言,需要宿主文件,它的宿主文件是html文件. Javascript是一种脚本语言,比HTML要复杂.不过即便你先前不懂编程,也不用担心,因为Javascr ...