约定,样式和Clojure常量的用法? [英] Conventions, Style, and Usage for Clojure Constants?

查看:102
本文介绍了约定,样式和Clojure常量的用法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在风格,约定,效率等方面,在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆