Forms
qinguan
posted @ 2011年7月24日 23:39
in Lisp
, 1171 阅读
——chapter3 Forms
Teach Yourself Scheme in Fixnum Days
在Scheme中,程序即数据。
到目前为止我们接触到的所有样例程序均是s-expressions。
但并不是所有的s-expressions都是自估值的,比如说点对。
在解释器中输入点对,会得到错误信息:
> (1 .2) . . procedure application: expected procedure, given: 1; arguments were: 0.2 > '(1 . 2) (1 . 2)
过程
Scheme提供了一些元过程,比如说cons、string->list,我们也可以通过lambda来定义:
> ((lambda (x) (+ x 2)) 3) 5 > (define add (lambda (x) (+ x 2) )) > (add 3) 5 > (define area (lambda (widh height) (* widh height))) > (area 2 4) 8 > (define area *) > (area 2 4) 8 >
define area * ,则area相当于对参数连乘操作。
有些过程可以接受变参。lambda的参数可以是一个列表,形式通常为(x ...)或者(x ... .z)。
当参数是点对的时候,点之间的参数被绑定到lambda上,点之后的参数被绑定到一个列表上。
apply
> (define x '(1 3 2 )) > (apply + x) 6 > (apply + 1 2 3 x) 12 >
序列
在scheme语句,lambda默认包含begin语句,如下两段代码效果一样:
(define display3 (lambda (arg1 arg2 arg3) (begin (display arg1) (display " ") (display arg2) (display " ") (display arg3) (newline)))) (display3 1 2 3) (define display_3 (lambda (arg1 arg2 arg3) (display arg1) (display " ") (display arg2) (display " ") (display arg3) (newline))) (display_3 1 2 3)
2011年7月25日 03:23
哈,LISP爱好者飘过,暂时还没深入学。
2021年4月22日 16:01
Outstanding article! I want people to know just how good this information is in your article. Your views are much like my own concerning this subject. I will visit daily your blog because I know. It may be very beneficial for me. 123movies websites
2021年4月24日 18:59
Someone Sometimes with visits your blog regularly and recommended it in my experience to read as well. The way of writing is excellent and also the content is top-notch. Thanks for that insight you provide the readers! 마진거래
2021年5月01日 18:37
Very interesting blog. Alot of blogs I see these days don't really provide anything that I'm interested in, but I'm most definately interested in this one. Just thought that I would post and let you know. Free Disney Plus accounts 2021
2021年5月02日 17:49
I think this is one of the most significant information for me. And i’m glad reading your article. But should remark on some general things, The web site style is perfect, the articles is really great : D. Good job, cheers fx커뮤니티
2021年5月03日 20:13 This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!. 최상위파워볼사이트
2021年5月06日 18:08
Thanks for sharing nice information with us. i like your post and all you share with us is uptodate and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job. visa para india
2021年5月11日 19:46
I high appreciate this post. It’s hard to find the good from the bad sometimes, but I think you’ve nailed it! would you mind updating your blog with more information? how to get free uc in pubg mobile without hack
2021年5月20日 16:11
I read that Post and got it fine and informative. how to make money with google maps ($100-$200 per day)
2021年6月11日 04:28
Wow, cool post. I'd like to write like this too - taking time and real hard work to make a great article... but I put things off too much and never seem to get started. Thanks though. Citronella oil Manufacturers in India
2021年6月17日 18:51
The post is written in very a good manner and it contains many useful information for me. coin master free spins link
2021年6月18日 03:03
If you are looking for more information about flat rate locksmith Las Vegas check that right away. 먹튀사이트
2021年6月20日 19:58
Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include. Mobile Legends
2021年6月24日 16:12
I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post. www.towelsforthebeach.com
2021年6月26日 23:02
Very interesting blog. Alot of blogs I see these days don't really provide anything that I'm interested in, but I'm most definately interested in this one. Just thought that I would post and let you know. 안전놀이터
2021年6月30日 01:51
This is my first time visit here. From the tons of comments on your articles,I guess I am not only one having all the enjoyment right here! new zealand eta
2021年7月05日 11:56
Efficiently written information. It will be profitable to anybody who utilizes it, counting me. Keep up the good work. For certain I will review out more posts day in and day out. how to become a payment service provider
2021年7月05日 20:19
I have read your article, it is very informative and helpful for me.I admire the valuable information you offer in your articles. Thanks for posting it.. สล็อต
2021年7月06日 12:21
Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with more information? It is extremely helpful for me. free keyword tool
2021年7月12日 14:41
I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Good day! 안전놀이터
2021年7月13日 18:26
Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info. Brawl Stars Free Gems Generator
2021年7月13日 18:27
Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info. Brawl Stars Free Gems Generator
2021年8月30日 13:37
I just found this blog and have high hopes for it to continue. Keep up the great work, its hard to find good ones. I have added to my favorites. Thank You. Search Engines
2021年9月04日 14:42
No doubt this is an excellent post I got a lot of knowledge after reading good luck. Theme of blog is excellent there is almost everything to read, Brilliant post. merchant services job description
2021年9月04日 21:58
No doubt this is an excellent post I got a lot of knowledge after reading good luck. Theme of blog is excellent there is almost everything to read, Brilliant post. become a payment service provider
2021年9月06日 13:19
thanks for the tips and information..i really appreciate it.. selling credit card processing
2021年9月10日 12:49
Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include. merchant services representative
2021年12月21日 22:33 Nice knowledge gaining article. This post is really the best on this valuable topic. 먹튀검증
2021年12月27日 19:33 Great post but I was wondering if you could write a little more on this subject? I’d be very thankful if you could elaborate a little bit further. Thanks in advance! https://scalar.usc.edu/works/office365-login/outlook-365.html
2021年12月29日 19:07
I read a article under the same title some time ago, but this articles quality is much, much better. How you do this.. 메이저사이트
2023年5月13日 17:59
On this page, you'll see my profile, please read this information. 에볼루션카지노
2023年6月03日 15:37
This is very interesting content! I have thoroughly enjoyed reading your points and have come to the conclusion that you are right about many of them. You are great. 평택 출장마사지
2023年6月05日 01:13
It is a great website.. The Design looks very good.. Keep working like that!. 파워볼사이트
2023年8月31日 14:41
No doubt this is an excellent post I got a lot of knowledge after reading good luck. Theme of blog is excellent there is almost everything to read, Brilliant post. last minute naar morro jable
2023年9月05日 20:12
This is a great article thanks for sharing this informative information. I will visit your blog regularly for some latest post. I will visit your blog regularly for Some latest post. EuroTogel Login
2023年10月22日 12:08
I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post. ufabetทางเข้าเล่น
2023年10月30日 19:42
I can set up my new idea from this post. It gives in depth information. Thanks for this valuable information for all,.. https://adamfayed.com/reasons-why-british-banks-in-dubai-might-not-be-your-best-option-in-2023
2023年11月06日 23:31
Some truly wonderful work on behalf of the owner of this internet site , perfectly great articles . comida cerca
2023年11月09日 20:46
I got too much interesting stuff on your blog. I guess I am not the only one having all the enjoyment here! Keep up the good work. chiropractic Dallas
2023年11月18日 17:25
I think this is an informative post and it is very beneficial and knowledgeable. Therefore, I would like to thank you for the endeavors that you have made in writing this article. All the content is absolutely well-researched. Thanks... ทางเข้าเล่นufabet
2023年11月18日 20:04
Wow, What an Outstanding post. I found this too much informatics. It is what I was seeking for. I would like to recommend you that please keep sharing such type of info.If possible, Thanks. ufabet เว็บหลัก
2023年11月18日 22:30
I think this is an informative post and it is very beneficial and knowledgeable. Therefore, I would like to thank you for the endeavors that you have made in writing this article. All the content is absolutely well-researched. Thanks... ufabetเว็บตรง
2023年11月19日 01:09
hi was just seeing if you minded a comment. i like your website and the thme you picked is super. I will be back. ufabet เว็บตรงทางเข้า มือถือ
2023年12月03日 17:16
Thank you very much for writing such an interesting article on this topic. This has really made me think and I hope to read more. เว็บแทงบอลตรงปลอดภัยที่สุดUFABET
2023年12月03日 20:54
You have a real ability for writing unique content. I like how you think and the way you represent your views in this article. I agree with your way of thinking. Thank you for sharing. ลิ้งค์แทงบอลUFABET
2023年12月05日 00:34
The emphasis on the deep web's role in protecting individuals from online fraud adds a layer of financial security to its societal impact.
2023年12月06日 21:52
Some truly wonderful work on behalf of the owner of this internet site , perfectly great articles . Business Strategy
2023年12月06日 22:14
There is so much in this article that I would never have thought of on my own. Your content gives readers things to think about in an interesting way. Thank you for your clear information. best food truck in lincoln ne
2023年12月09日 20:31
Thanks for the best blog. it was very useful for me.keep sharing such ideas in the future as well. UFABETเว็บแทงบอลต่างประเทศ
2023年12月12日 03:06
I went over this website and I believe you have a lot of wonderful information, saved to my bookmarks best food truck in lincoln ne
2023年12月20日 17:40
With so many books and articles coming up to give gateway to make-money-online field and confusing reader even more on the actual way of earning money, qq101
2024年1月30日 03:50
Thanks, that was a really cool read! employee motivation and engagement strategies
2024年3月02日 19:54
The positive description of privacy coins as the ultimate solution for enhanced privacy features adds a forward-looking perspective to the article. Download SiMontok
2024年10月24日 19:27
All the contents you mentioned in post is too good and can be very useful. I will keep it in mind, thanks for sharing the information keep updating, looking forward for more posts.Thanks Tonic Greens Reviews
2024年11月10日 17:05
Hello I am so delighted I located your blog, I really located you by mistake, while I was watching on google for something else, Anyways I am here now and could just like to say thank for a tremendous post and a all round entertaining website. Please do keep up the great work.bestapp
2024年11月13日 23:32
I was surfing the Internet for information and came across your blog. I am impressed by the information you have on this blog. It shows how well you understand this subject. OHIO FAKE ID