Calling Scala from Clojure
In this recipe, we will integrate Clojure and Scala. We will configure a mixing project using Leiningen.
Getting ready
We create a project by lein new clojure-scala
and project.clj
as follows:
(defproject clojure-scala "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.8.0"] [org.scala-lang/scala-library "2.11.7"]] :plugins [[io.tomw/lein-scalac "0.1.2"]] :scala-source-path "src/scala" :scala-version "2.11.7" :prep-tasks ["scalac"] :main clojure-scala.core )
After modifying the project.clj
, start the REPL.
How to do it...
We will explain how Clojure code calls ...
Get Clojure Programming Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.