如何计算Clojure函数的圈复杂度?

编程入门 行业动态 更新时间:2024-10-14 14:20:47
本文介绍了如何计算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?

推荐答案

宏是一种抽象,不应该用于CC计算,

Macros are an abstraction and should not contributed to the CC calculation, any more than a function call would.

话虽如此,我认为CC对Clojure并不是特别有趣。我对测量过度使用可变性的东西更感兴趣。

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.

更多推荐

如何计算Clojure函数的圈复杂度?

本文发布于:2023-11-30 17:26:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1650891.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:复杂度   函数   Clojure

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!