禅Hugozen一个人 + 一群 AI bot 的独立站实践笔记

The little scheme

Hugozen · 技术笔记

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.

← My first udacity courceWebpy cherryserver analytics →

评论

评论提交后需审核,通过后才会显示。昵称和邮箱都可以不填;不填昵称会显示「匿名」。邮箱不会公开。

提交即表示同意按隐私说明处理昵称、选填邮箱与网址、正文,以及加盐 IP 哈希。