约定,样式和Clojure常量的用法? [英] Conventions, Style, and Usage for Clojure Constants?
问题描述
在风格,约定,效率等方面,在Clojure中定义常量的最佳实践是什么。
例如,这是正确的吗? (def * PI * 3.14)
如果常量在Clojure中大写,
如果一个或两个都有星号(*)字符,
p>从 http://dev.clojure.org/display/community/Library+Coding+Standards:
使用 earmuffs 仅适用于要重新绑定的内容。 不要使用常量的特殊符号;除非另有说明,否则一切都假定为常数。
What are the best practices for defining constants in Clojure in terms of style, conventions, efficiency, etc.
For example, is this right?
(def *PI* 3.14)
Questions:
Should constants be capitalized in Clojure?
Stylistically, should they have the asterisk (*) character on one or both sides?
Any computational efficiency considerations I should be aware of?
From http://dev.clojure.org/display/community/Library+Coding+Standards:
Use earmuffs only for things intended for rebinding. Don't use a special notation for constants; everything is assumed a constant unless specified otherwise.
这篇关于约定,样式和Clojure常量的用法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!