博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
全民Scheme(1):数字游戏
阅读量:6244 次
发布时间:2019-06-22

本文共 2308 字,大约阅读时间需要 7 分钟。

刚刚看到两句话,感觉不错,分享给大家:

1.用户的问题。就是我们的问题

2.做一些用户想要的东西

(define add1  (lambda (x)    (+ 1 x)))(define sub1  (lambda (x)    (- x 1)))(add1 67)(sub1 5)(sub1 0)(zero? 22)(define addup  (lambda (tup)    (cond      ((null?

tup) 0) (else (+ (car tup) (addup (cdr tup))))))) (addup '(3 4 5)) (define * (lambda (x y) (cond ((eq? 1 x) y) (else (+ y (* (sub1 x) y)))))) (* 3 9) (define tup+ (lambda (tup1 tup2) (cond ((null?

tup1) '()) (else (cons (+ (car tup1) (car tup2)) (tup+ (cdr tup1) (cdr tup2))))))) (tup+ '(2 3 4 5) '(5 4 3 2)) (define > (lambda (x y) (cond ((zero? x) #f) ((zero? y) #t) (else (> (sub1 x) (sub1 y)))))) (> 4 3) (> 3 3) (> 3 4) (define < (lambda (x y) (cond ((zero?

y) #f) ((zero? x) #t) (else (< (sub1 x) (sub1 y)))))) (< 3 3) (< 4 3) (< 3 4) (define = (lambda (x y) (cond ((> x y) #f) ((< x y) #f) (else #t)))) (= 3 4) (= 3 3) (= 4 3) (define expt (lambda (x y) (cond ((zero?

y) 1) (else (* x (expt x (sub1 y))))))) (expt 5 3) (define / (lambda (x y) (cond ((< x y) 0) (else (add1 (/ (- x y) y)))))) (/ 10 2) (define length (lambda (lat) (cond ((null? lat) 0) (else (add1 (length (cdr lat))))))) (length '(good hello)) (define pick (lambda (n lat) (cond ((eq? n 1) (car lat)) (else (pick (sub1 n) (cdr lat)))))) (pick 3 '(hotdogs with hot mustard)) (define no-nums (lambda (list) (cond ((null? list) '()) ((number? (car list)) (no-nums (cdr list))) (else (cons (car list) (no-nums (cdr list))))))) (no-nums '(5 pears 6 prunes 9 dates)) (define all-nums (lambda (lat) (cond ((null? lat) '()) ((number? (car lat)) (cons (car lat) (all-nums (cdr lat)))) (else (all-nums (cdr lat)))))) (all-nums '(99 abc 33 mm 9 gg fuck)) (define eqlat? (lambda (a1 a2) (cond ((and (null? a1) (null? a2)) #t) ((and (number? (car a1)) (number? (car a2))) (cond ((= (car a1) (car a2)) (eqlat?

(cdr a1) (cdr a2))) (else #f))) ((eq?

(car a1) (car a2)) (eqlat?

(cdr a1) (cdr a2))) (else #f)))) (eqlat? '(a b c 33) '(a b c 33)) (define occur (lambda (a lat) (cond ((null? lat) 0) ((number? a) (cond ((and (number? (car lat)) (= (car lat) a)) (add1 (occur a (cdr lat)))) (else (occur a (cdr lat))))) ((number? (car lat)) (occur a (cdr lat))) ((eq?

a (car lat)) (add1 (occur a (cdr lat)))) (else (occur a (cdr lat)))))) (occur 'a '(a b c d e a 3 4 a)) (occur 3 '(b cd e 3 4 3 ed 3)) (define one? (lambda (n) (= n 1))) (one? 3)

转载地址:http://mhsia.baihongyu.com/

你可能感兴趣的文章
多线程中数的原子性加减
查看>>
客户被绑,蒙眼,惊问:“想干什么?” 对方不语,鞭笞之,客户求饶:“别打,要钱?” 又一鞭,“十万够不?” 又一鞭,“一百万?” 又一鞭。客户崩溃:“你们TMD到底要啥?” “要什么?......
查看>>
jQuery.fly插件实现添加购物车抛物线效果
查看>>
[svc]linux的ip命令操作接口和路由表
查看>>
39.Node.js域名解析---DNS模块
查看>>
Ajax 跨域,这应该是最全的解决方案了
查看>>
vs2010下release版本调试设置
查看>>
Windows连接Linux虚拟机里面的Docker容器
查看>>
MYSQLDUMP参数详解(转)
查看>>
SLA
查看>>
MyProject / FuzzyPages | Elias的个人主页
查看>>
三子棋局-挑战你的逻辑思维
查看>>
Linux 安装 MySQL / MySQL 主从备份
查看>>
python调用linux shell脚本,并返回结果一例
查看>>
IT的一些常识
查看>>
无边框Winform 简单实现拖动
查看>>
潜移默化学会WPF--Border,焦点移动
查看>>
css解决span宽度问题
查看>>
调频广播六十年
查看>>
android sdk 如何重新生成debug.keystore
查看>>