Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 584075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:51:36+00:00 2026-05-13T14:51:36+00:00

How can I take a large existing Java project and start to add Clojure

  • 0

How can I take a large existing Java project and start to add Clojure modules? For example, in the code below, I’d like to make the following functions available in Java: state?, zip?, state-list, zipcode-list. The two predicates will return a boolean, but the “getters” will return arrays.

(def *states* (list "NJ" "NY" "CA"))
(def *zipcodes*  (list 12345 54343 98765))

(defn member [x sq]
  (if (seq sq)
    (if (= x (first sq))
      sq
      (recur x (rest sq)))))

(defn state? [aState]
  (not (= (member aState *states*) nil)))

(defn zip? [aZip]
  (not (= (member aZip *zipcodes*) nil)))

(defn state-list []
  *states*)

(defn zipcode-list []
  *zipcodes*)
;; ---------------
(state? "AA")
(state? "CA")
(zip? 11111)
(zip? 12345)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:51:37+00:00Added an answer on May 13, 2026 at 2:51 pm

    I would compile it using leiningen then add the jar file to my java project as a build dep. Here is a great video on using leiningen.
    then you would call it directly from java. Leiningen has an uberjar option that bulds in clojure and all your clojure dependencies so you only have to worry about one file. I like this because its less work.

    A more java friendly approach would be to add an ant task to build it along with the java project its just a little more work

    for the functions that need to return proper java arrays call to-array on them

    contrary to many of the top “calling clojure from java” hits you should not need to call the clojure runtime RT.

    PS: my favorite tag line “I would like to use a java library called clojure” I asked Rich he said this was cool 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What are some apraoches i can take to rewrite fairly large procedural php roughly
I have several large CSS files and making a change can sometimes take a
Zlib::GzipReader can take an IO, or IO-like, object. as it's input, as stated in
We have a (large) SELECT query, that can take ~30 seconds to run. I
It is obvious that given any large codebase separate compilation of modules can significantly
I have a large file I'm uploading. The entire request can take more than
When a user loads a project file into my application it can take a
If you take an existing C code base and compile it with a C++
I Have a large number of queries some of which can take half an
I can take snapshot of a component. But the problem is the component is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.