MIT/GNU Scheme 第一日
2009-02-02 23:28
260 查看
;---------------------------最原始的-------------------------------
(+ 2 3 4)
;Value: 9
;---------------------------定义Emmbed--------------------
(define x 2)
(define mm (* x 3))
mm
;Value:6
;-----------------------几种函数的定义---------------------
(define (sum a b)
(+ a b))
(sum 1 2)
;Value:3
;------------- Cond 使用 --
(define (abs x)
(cond ( (> x 0) x)
( (< x 0) (- x))
(else 0)))
(abs -11)
;Value :11
;--------------- If 使用 --- 逻辑运算使用, and or not -------------
(define (summ a b c)
(cond ((and (> a b) (> c b)) (+ a c))
((and (> a c) (> b c)) (+ a b))
(else (+ b c))))
(summ 1 2 3)
;Value:5
(+ 2 3 4)
;Value: 9
;---------------------------定义Emmbed--------------------
(define x 2)
(define mm (* x 3))
mm
;Value:6
;-----------------------几种函数的定义---------------------
(define (sum a b)
(+ a b))
(sum 1 2)
;Value:3
;------------- Cond 使用 --
(define (abs x)
(cond ( (> x 0) x)
( (< x 0) (- x))
(else 0)))
(abs -11)
;Value :11
;--------------- If 使用 --- 逻辑运算使用, and or not -------------
(define (summ a b c)
(cond ((and (> a b) (> c b)) (+ a c))
((and (> a c) (> b c)) (+ a b))
(else (+ b c))))
(summ 1 2 3)
;Value:5
相关文章推荐
- MIT/GNU Scheme用户手册(二)
- 运行MIT-GNU Scheme出现“Requested allocation is too large”
- Drop MIT/GNU Scheme
- 运行MIT-GNU Scheme出现“Requested allocation is too large”
- MIT/GNU Scheme用户手册(四)
- MIT/GNU Scheme用户手册(六)
- MIT/GNU Scheme用户手册(三)
- MIT/GNU Scheme
- MIT/GNU Scheme用户手册(一)
- Ububtu/Linux系统安装mit-scheme
- windows配置 emacs + mit-scheme
- Ubuntu 8.04 mit scheme start problem solution
- slime for mit scheme
- mit-scheme user manual note
- Fedora下编译mit-scheme
- MIT-Scheme用法
- Mit-Scheme 安装小记
- [bigdata-036] mit-scheme试用
- mit-scheme编译文件
- Mac 上为mit-scheme配置emacs环境