gpt4 book ai didi

clojure - 什么是 :use 的惯用 clojure

转载 作者:行者123 更新时间:2023-12-04 05:57:59 25 4
gpt4 key购买 nike

我已经看到了 :use 的几种不同方式在 clojure 中——惯用的/首选方法是什么?

#1

(ns namespace.core
(:use [[something.core]
[another.core]]))

或 #2 编辑:将此与 :only 结合使用.
(ns namespace.core
(:use [something.core]
[another.core]))

或#3
(ns namespace.core
(:use [something.core
another.core]))

或#4
(ns namespace.core
(:use (something.core
another.core)))

或 #5 编辑:这是惯用的,但应该使用 :use如#2
(ns namespace.core
(:use something.core
another.core))

最佳答案

选项#5 是惯用的,除非你传递了额外的选项,比如:only、:exclude 等。Colin's blog post详细介绍了选项。

处理命名空间的 API 非常难学。但是,它肯定有足够的能力用于广泛的用途,因此重写的压力尚未达到任何人的沸点。

关于clojure - 什么是 :use 的惯用 clojure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5799438/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com