R5RS is the Revised5 Report on the Algorithmic Language Scheme.参考http://www.schemers.org/Documents/Standards/R5RS/

racket let 用法:

(let ([id val-expr] ...) body ...+)

(let proc-id ([id init-expr] ...) body ...+)
The first form evaluates the val-exprs left-to-right, creates a newlocation for each id, and places the values into the locations. It then evaluates the bodys, in which the ids are bound. The last bodyexpression is in tail position with respect to the let form. The ids must be distinct according to bound-identifier=?.

Examples:

> (let ([x 5]) x)

5

> (let ([x 5])
    (let ([x 2]
          [y x])
      (list y x)))

'(5 2)

The second form evaluates the init-exprs; the resulting values become arguments in an application of a procedure (lambda (id ...) body ...+), where proc-id is bound within the bodys to the procedure itself.

Example:

> (let fac ([n 10])
    (if (zero? n)
        1
        (* n (fac (sub1 n)))))

3628800

syntax

(let* ([id val-expr] ...) body ...+)

Like let, but evaluates the val-exprs one by one, creating a locationfor each id as soon as the value is available. The ids are bound in the remaining val-exprs as well as the bodys, and the ids need not be distinct; later bindings shadow earlier bindings.

Example:

> (let* ([x 1]
         [y (+ x 1)])
    (list y x))

'(2 1)

r5rs:

library syntax:  (let <bindings> <body>) 

Syntax: <Bindings> should have the form ((<variable1> <init1>) ...),

where each <init> is an expression, and <body> should be a sequence of one or more expressions. It is an error for a <variable> to appear more than once in the list of variables being bound.

Semantics: The <init>s are evaluated in the current environment (in some unspecified order), the <variable>s are bound to fresh locations holding the results, the <body> is evaluated in the extended environment, and the value(s) of the last expression of <body> is(are) returned. Each binding of a <variable> has <body> as its region.

(let ((x 2) (y 3))
  (* x y))                              ===>  6

(let ((x 2) (y 3))
  (let ((x 7)
        (z (+ x y)))
    (* z x)))                           ===>  35

See also named let, section 4.2.4.

library syntax:  (let* <bindings> <body>) 

Syntax: <Bindings> should have the form ((<variable1> <init1>) ...),

and <body> should be a sequence of one or more expressions.

Semantics: Let* is similar to let, but the bindings are performed sequentially from left to right, and the region of a binding indicated by(<variable> <init>) is that part of the let* expression to the right of the binding. Thus the second binding is done in an environment in which the first binding is visible, and so on.

(let ((x 2) (y 3))
  (let* ((x 7)
         (z (+ x y)))
    (* z x)))                     ===>  70

let区别(关于racket和r5rs)的更多相关文章

  1. racket

    let 和 let* 区别 ``` racket // 这是对的 (let* ([x (random 4)][o (random 4)] [diff (number->string (abs ( ...

  2. Scheme r5rs letrec的用法

    说明,这是r5rs的用法. (letrec ((<variable> <init>) ...) <body>) 假设((<variable> <i ...

  3. racket学习-call/cc (let/cc)

    Drracket continuation 文中使用let/cc代替call/cc Racket文档中,let/cc说明为: (let/cc k body ...+) Equivalent to (c ...

  4. c#与java的区别

    经常有人问这种问题,用了些时间java之后,发现这俩玩意除了一小部分壳子长的还有能稍微凑合上,基本上没什么相似之处,可以说也就是马甲层面上的相似吧,还是比较短的马甲... 一般C#多用于业务系统的开发 ...

  5. jquery和Js的区别和基础操作

    jqery的语法和js的语法一样,算是把js升级了一下,这两种语法可以一起使用,只不过是用jqery更加方便 一个页面想要使用jqery的话,先要引入一下jqery包,jqery包从网上下一个就可以, ...

  6. 【原】nodejs全局安装和本地安装的区别

    来微信支付有2年多了,从2年前的互联网模式转变为O2O模式,主要的场景是跟线下的商户去打交道,不像以往的互联网模式,有产品经理提需求,我们帮忙去解决问题. 转型后是这样的,团队成员更多需要去寻找业务的 ...

  7. 探究@property申明对象属性时copy与strong的区别

    一.问题来源 一直没有搞清楚NSString.NSArray.NSDictionary--属性描述关键字copy和strong的区别,看别人的项目中属性定义有的用copy,有的用strong.自己在开 ...

  8. X86和X86_64和X64有什么区别?

    x86是指intel的开发的一种32位指令集,从386开始时代开始的,一直沿用至今,是一种cisc指令集,所有intel早期的cpu,amd早期的cpu都支持这种指令集,ntel官方文档里面称为&qu ...

  9. Java中Comparable与Comparator的区别

    相同 Comparable和Comparator都是用来实现对象的比较.排序 要想对象比较.排序,都需要实现Comparable或Comparator接口 Comparable和Comparator都 ...

随机推荐

  1. Typecho 代码阅读笔记(三) - 插件机制

    转载请注明出处:http://blog.csdn.net/jh_zzz 以 index.php 为例: /** 初始化组件 */ Typecho_Widget:: widget('Widget_Ini ...

  2. SPI 四种模式

    SPI时钟极性CPOL, = 0表示在没有数据传输时为低电平,= 1表示没有数据传输时为高电平. SPI时钟相位CPHA,= 0表示时钟的第一个沿更新数据.第二个沿锁存数据,= 1表示时钟的第一个沿锁 ...

  3. 8051、ARM和DSP指令周期的测试与分析

    在实时嵌入式控制系统中,指令周期对系统的性能有至关重要的影响.介绍几种最常用的微控制器的工作机制,采用一段循环语句对这几种微控制器的指令周期进行测试,并进行分析比较.分析结论对系统控制器的选择有一定的 ...

  4. 数据类型MSVC和gcc/g++的不同

    前言: 在16位环境下,int/unsigned int 占16位,long/unsigned long占32位 在32位环境下,int占32位,unsigned int占16位,long/unsig ...

  5. swing的第一课

    Swing介绍 Swing API 可扩展 GUI组件,以减轻开发者的生活创造基于JAVA前端/GUI应用.它是建立在AWT API之上,并作为 AWTAPI 的更换,因为它几乎每一个控制对应 AWT ...

  6. Remove Nth Node From End of List 解答

    Question Given a linked list, remove the nth node from the end of list and return its head. For exam ...

  7. Repeated DNA Sequences 解答

    Question All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: ...

  8. poj1001(高精度)

                                                               Exponentiation Time Limit: 500MS   Memory ...

  9. fullcalender

    http://blog.csdn.net/francislaw/article/details/7740630 引用 <link rel="stylesheet" href= ...

  10. Android开发之Intent.Action

    1 Intent.ACTION_MAIN String: android.intent.action.MAIN 标识Activity为一个程序的開始.比較经常使用. Input:nothing Out ...