如何计算 Clojure 函数的圈复杂度?
计算 Clojure 函数的圈复杂度的合理方法是什么?根据“if”和“cond”等函数计算决策点很容易,但使用宏就开始变得棘手。有人尝试过 Clojure 或其他功能语言吗?
What would be a reasonable way to calculate the cyclomatic complexity of a Clojure function? It's easy to count decision points based on functions like 'if' and 'cond', but it starts to get tricky with macros. Anyone has tried this for Clojure or maybe another functional language?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
宏是一种抽象,不应该参与 CC 计算,就像函数调用一样。
也就是说,我不认为 CC 对于 Clojure 来说特别有趣。我对衡量可变性过度使用的东西更感兴趣。
Macros are an abstraction and should not contributed to the CC calculation, any more than a function call would.
That said, I don't think that CC is particularly interesting for Clojure. I would be more interested in something that measured overuse of mutability.