clojure和scala互操作 [英] clojure and scala interop

查看:117
本文介绍了clojure和scala互操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很熟悉scala类/对象可以从clojure调用,因为scala编译为字节码,而clojure很舒服。

I am familiar that scala classes / objects can be called from clojure, as scala compiles to bytecode, and clojure is comfortable with it.

然而,它是无痛的调用clojure函数,并从scala导入命名空间?

However is it as painless calling clojure functions, and importing namespaces from scala ?

我想混合使用优秀的提升框架和clojure,基本上从电梯调用clojure代码。

I would like to mix the excellent lift framework and clojure, basically call clojure code from lift.

推荐答案

Scala中的导入语义基本上与Java相同。您应该能够通过阅读如何从Java调用Clojure代码来获取所需的信息,然后在Scala中应用相同的原则。

Semantics for imports in Scala are basically the same as Java. You should be able to get the info you need by reading up on how to invoke Clojure code from Java, then apply the same principles in Scala.

如果要编译你的Clojure代码,并将其作为JAR包含在你的类路径中,那么这篇文章应该是相关的:

If you want to compile your Clojure code and include it as a JAR in your classpath then this post should be relevant:

从Java调用Clojure

如果你想动态编译/解释.clj文件, this:

If you'd rather dynamically compile/interpret the .clj files then you should read this:

Clojure编程:从Java调用Clojure < a>

Clojure Programming: Invoking Clojure from Java

第一个选项对我来说好多了。

The first option seems a lot nicer to me.

这篇关于clojure和scala互操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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