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. IE9或以上的浏览器flash值为空时,导致domready不触发

    在前些时间开发中遇到一个问题当flash值<param name="movie" value=""/>为空时,IE版本>=9不会触发domre ...

  2. Linq to SQL 基础篇

    LinqtoSqlDataContext Linq = new LinqtoSqlDataContext(ConfigurationManager.ConnectionStrings["sz ...

  3. PHP header函数使用教程

    在php语言中,header()这个函数很有用的,尤其在用到ajax时候,他会帮你解决一些意想不到的问题.下面是header的一些详细讲解.希望对phper有帮助 代码如下: <?php// f ...

  4. ubuntu adobe flash player 安装

    常规做法 1.先更新sudo apt-get update 2. sudo apt-get install flashplugin-installer 这次却卡在downloading这里 下不去.无 ...

  5. CoreCLR on Mac:体验managed exception handling

    C#测试代码: using System; class Program { static void A() { try { Console.WriteLine("Throwing an ex ...

  6. 怎么实现元素ol的降序排序显示

    首先介绍一下什么是ol元素.这里直接引用MDN里面的定义:The HTML <ol> Element (or HTML Ordered List Element) represents a ...

  7. UML中依赖(Dependency)和关联(Association)之间的区别

    一般情况下,使用关联(association)来表示像类中的字段等.这个关系是始终存在的,因此你可以随时针对关联项进行访问调用,例如可以始终从 Customer 对象获取 Order 对象.但事实上它 ...

  8. C++11 并发指南六(atomic 类型详解四 C 风格原子操作介绍)

    前面三篇文章<C++11 并发指南六(atomic 类型详解一 atomic_flag 介绍)>.<C++11 并发指南六( <atomic> 类型详解二 std::at ...

  9. 使用七牛云存储实现Android的自动更新

    为了修复Bug或更新软件,我们通常需要实现自动更新,没有哪一个牛逼的人能够搞到每一个用户的机子去帮他们更新. 1.自动更新的流程 我们将了解一下自动更新的思路.既然软件要自动更新,那么它必须知道自己是 ...

  10. SignalR 简单示例

    一.什么是 SignalR ASP.NET SignalR is a library for ASP.NET developers that simplifies the process of add ...