Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?

question from:https://stackoverflow.com/questions/3579063/conventions-style-and-usage-for-clojure-constants

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
159 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...