Scheme简介
Scheme是1970年代著名的函数式编程语言。是Lisp(LISt Processing)语言的一门变式。大多数人想到Scheme首先是其独特的语法,因为其采用前缀表示法和嵌套括号,并且具有一流的函数和优化的尾递归的特征,在当时属于较为新颖的特征。
表达 Expression
原子表达式 Atomic Expression
就像和Python一样,Scheme原子表达式或者说基本表达式只要一个简单的步骤来评估。表达式包括数字,布尔型,符号。
scm> 1234 ; integer
1234
scm> 123.4 ; real number
123.4
符号 Symbols
符号的作用像Python中的name,但是也不完全是。准确来说,Scheme中的symbol是一种值的类型。
scm> quotient ; A name bound to a built-in procedure
#[quotient]
scm> 'quotient ; An expression that evaluates to a symbol
quotient
scm> 'hello-world!
hello-world!
Booleans
布尔型 Booleans
在Scheme中,除了#f这一特殊布尔值以外的所有值都解释为True值,即真值,不像Python,0也被认为是False值。