zoukankan      html  css  js  c++  java
  • Yet Another Scheme Introduction学习

    Chapter 2

    Function exact->inexact is to convert from fractional numbers to floating point numbers.

    Formulas consisting of parentheses, tokens, and separators are called S-expressions.

    Chapter 3

    Cons cells are a memory spaces which storage two addresses.

    Function cons allocates a memory space for two addresses. and stores the address to 1 in one part and to 2 in the other part. The part storing the address to 1 is called car part and that storing the address to 2 is called cdr part. Car and cdr are abbreviations of Contents of the Address part of the Register and Contents of the Decrement part of the Register.

    Lists are (beaded) cons cells with the cdr part of the last cons cell being '(). '() is called the empty list, which is included to lists.

    Data structures which do not use cons cells are called atom. Numbers, characters, strings, vectors, and '() are atom. '() is an atom and a list as well.

    A special form named quote is used to protect tokens from evaluation.

    Functions that returns the car part and the cdr part of a cons cell is called car and cdr, respectively.

    Function list is available to make a list consisting of several elements. Function list takes arbitrary numbers of arguments and returns a list of them.

    Chapter 4

    You use define to bind a symbol to a value. You can define any kind of global parameters, such as numbers, characters, lists, etc. and functions by this operator.

    The define is a operator to declare variables and takes two arguments. The operator declares to use the first argument as a global parameter and binds it to the second argument.

    The lambda is a special form to define procedures. The lambda takes more than one arguments and the first argument is the list of parameters that the procedure takes as arguments. 

    Chapter 5

    false is represented by #f. The representing value of true is #t.

    so many operaters and functions

    chapter 6

    Local variables can be defined using the let expression.

    (let binds body)

    Variables are declared and assigned to initial values in the binds form. The body consists of arbitrary numbers of S-expressions.

    [binds] → ((p1 v1) (p2 v2) ...)

    Variables p1, p2 ... are declared and bind them to the initial values, v1, v2 ... The scope of variables is the body, which means that variables are valid only in the body.

    The let* expression is available to refer variables which is defined in the same binding form. Actually, the let* expression is a syntax sugar of nested let expressions.

  • 相关阅读:
    [mysql]增加域设置 auto_increment
    【mysql乱码】解决php中向mysql插入中文数据乱码的问题
    WIN7 嵌入式系统安装教程 Windows Embedded Standard 2011 安装
    STM32F4 串口实验中收不到超级终端发送的数据,调试工具却可以
    STM32F4 输入输出(GPIO)模式理解
    STM32——GPIO之从库函数到寄存器的前因后果
    STM32 下的库函数和寄存器操作比较
    JLINK(SEGGER)灯不亮 USB不识别固件修复、clone修改
    lwip Light Weight (轻型)IP协议
    stm32开发之串口的调试
  • 原文地址:https://www.cnblogs.com/scige/p/3378876.html
Copyright © 2011-2022 走看看