gpt4 book ai didi

clojure - 如何区分 Clojure-JVM 和 Clojure-CLR

转载 作者:行者123 更新时间:2023-12-02 23:20:37 27 4
gpt4 key购买 nike

如何在 clojure-lang 脚本文件中检测该脚本是在 JVM 版本还是 CLR 版本上运行?

提前致谢。

最佳答案

此处使用的工具是读者条件:https://clojure.org/guides/reader_conditionals

... Reader conditionals are integrated into the Clojure reader, and don’t require any extra tooling beyond Clojure 1.7 or greater. To use reader conditionals, all you need is for your file to have a .cljc extension and to use Clojure 1.7 or ClojureScript 0.0-3196 or higher ...

... The standard reader conditional behaves similarly to a traditional cond. The syntax for usage is #? and looks like:

#?(:clj  (Clojure expression)
:cljs (ClojureScript expression)
:cljr (Clojure CLR expression)
:default (fallthrough expression))

关于clojure - 如何区分 Clojure-JVM 和 Clojure-CLR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54869979/

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