如果你真的想获取 Clojure,我强烈推荐 The Joy of Clojure 一书。它是由两位除了原作者之外最了解该语言的人编写的。他们解释了你可以做什么,你应该如何做,然后是为什么。我不认为这是一本很好的关于语言的第一本书/学习经验,但是我认为这是一旦你掌握了基础知识就需要学习的第二本书。
If you really want to GET Clojure, I strongly recommend The Joy of Clojure book. It is written by two of the guys who know the language best next to the original creator. They explain what you can do, how you should do it, and then the whys. I don't think it is a good FIRST book/learning experience on the language, however I think it is the required SECOND book to study from once you have your fundamentals.
Both writing and reading code are appropriate and necessary. If the Clojure source code seems intimidating, start with smaller projects, e.g., https://github.com/technomancy/robert-hooke. Since you have been doing the 4Clojure problems, why not look at others' solutions after you have written your own? Search for the hashtag #4clojure in twitter or just visit https://twitter.com/#!/search/%234clojure.
使用 let 绑定您已经获得的值。例如,在几个不同的地方多次调用 (first lset) 会使您的代码更加冗长。
Abstract your code into smaller functions that do one thing and one thing well. Once you have achieved this you can try to make it more elegant. Sometimes you notice your final result is so sweet and short you actually end up inlining it.
Bind the values you have already obtained by using let. For instance calling (first lset) several times in several different places makes your code more verbose.
I would suggest deconstructing a complex example. At the Denver Clojure Meetup, we deconstructed the Joy of Clojure Quicksort listing 6.3 line by line. I have the slides here.
发布评论
评论(5)
如果你真的想获取 Clojure,我强烈推荐 The Joy of Clojure 一书。它是由两位除了原作者之外最了解该语言的人编写的。他们解释了你可以做什么,你应该如何做,然后是为什么。我不认为这是一本很好的关于语言的第一本书/学习经验,但是我认为这是一旦你掌握了基础知识就需要学习的第二本书。
If you really want to GET Clojure, I strongly recommend The Joy of Clojure book. It is written by two of the guys who know the language best next to the original creator. They explain what you can do, how you should do it, and then the whys. I don't think it is a good FIRST book/learning experience on the language, however I think it is the required SECOND book to study from once you have your fundamentals.
编写和阅读代码都是适当且必要的。如果 Clojure 源代码看起来令人生畏,请从较小的项目开始,例如 https://github.com/technomancy/罗伯特·胡克。既然你一直在做4Clojure问题,为什么不在自己写完之后看看别人的解决方案呢?在 Twitter 中搜索主题标签 #4clojure 或访问 https://twitter.com/#!/search /%234clojure。
祝你好运!
Both writing and reading code are appropriate and necessary. If the Clojure source code seems intimidating, start with smaller projects, e.g., https://github.com/technomancy/robert-hooke. Since you have been doing the 4Clojure problems, why not look at others' solutions after you have written your own? Search for the hashtag #4clojure in twitter or just visit https://twitter.com/#!/search/%234clojure.
Good luck!
将你的代码抽象成更小的函数,只做一件事,并且做好一件事。一旦你实现了这一点,你就可以尝试让它变得更加优雅。有时你会发现你的最终结果是如此甜蜜和简短,以至于你实际上最终将其内联。
使用
let
绑定您已经获得的值。例如,在几个不同的地方多次调用(first lset)
会使您的代码更加冗长。Abstract your code into smaller functions that do one thing and one thing well. Once you have achieved this you can try to make it more elegant. Sometimes you notice your final result is so sweet and short you actually end up inlining it.
Bind the values you have already obtained by using
let
. For instance calling(first lset)
several times in several different places makes your code more verbose.阅读代码。阅读写得好的代码。
您可以从 clojure 的源代码开始 - 在这里获取它:https://github。 com/clojure/clojure/tree/master/src/clj/clojure。通常,语言标准库中的代码是/必须是相当惯用的。所以这是开始您的旅程的好地方。
Read code. Read well written code.
You could start with clojure's source - get it here: https://github.com/clojure/clojure/tree/master/src/clj/clojure. Usually the code in the standard-lib of a language is/has to be quite idiomatic. So this is a good place to start your journey.
我建议解构一个复杂的例子。在丹佛 Clojure 聚会上,我们逐行解构了 Clojure 的乐趣 快速排序列表 6.3。我的幻灯片位于此处。
I would suggest deconstructing a complex example. At the Denver Clojure Meetup, we deconstructed the Joy of Clojure Quicksort listing 6.3 line by line. I have the slides here.