the little scheme

Introduction

scheme, a dialect of lisp.

Notes

  • The law of Car
    The primitive car is defined only for non-empty lists. The cdr of any non-empty list is always another list.
  • The law of Cons
    The primitive takes two arguments. The second argument to must be a list. The result is a list.
  • The law of Null?
    The primitive null? is defined only for lists.
  • The law of eq?
    The primitive eq? takes two arguments.Each must be a nonnumeric atom.
  • The First Commandment
    Always ask null? as the first question in expressing any function.
  • The Second Commandment
    Use cons to build lists.
  • The Third Commandment
    When building a list, describe the first typical element, and then cons it onto the natural recursion.
  • The Fourth Commandment
    Always change at least one argument while recurring. It must be changed to be closer to the termination. The changing argument must be tested in the termination condition: when using cdr, test termination with null?.
  • The Fifth Commandment
    When building a value with +, always use 0 for the value of the terminating line, for adding 0 does not change the value of an addition.
    When building a value with x, always use 1 for the value of the terminating line, for multiplying by 1 does not change the value of multiplication.
    When building a value with cons, always consider () for the value of the terminating line.

why and how in lisp

心血来潮,看起了 lisp。起因是我太寂寞了,想找些函数式语言,来打发有强迫症的自己。

当然了,原因不只这么简单,更重要的是,我想去了解函数式语言的起源,或者,写一个自己的编译器玩玩也不错.

还有,就是找到函数式语言本质的东西,而不是游走在猛蛇、砖石的门外,不得深入,再深入。

每个周六日,都是我的外遇日,因为我终于有两个完整的日子,去陪我这两个小情人了。

人说程序员是多情的,这倒是真的。只是我还算专一,至今仍泡在函数式编程的圈子里。

又是圈子,真是个难以接受的事实。

tut&link