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

  • Home
  • SEARCH
  • 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 8319249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:15:56+00:00 2026-06-08T22:15:56+00:00

I’m trying to load and/or compile a .clj file from within another .clj file.

  • 0

I’m trying to load and/or compile a .clj file from within another .clj file.
I’m doing this because the file I’m trying to load just contains a bunch of maps, and I intend eventually to replace these with an xml file. I could just :use the file and it’ll work, but I’m trying to go through the exercise of loading an external bunch of data.

Through some random hacking around the repl (via emacs etc) I was able to (load "default_libs") as well as (compile...) it somehow (using different combinations of namespace qualifiers, ', and ") and get access to the maps, but after restarting the repl it didn’t work any more, and anyway I had to use the full namespace name to get to the data.

This is lib_manager.clj:

(ns mycad.lib-manager
  (:use [clojure repl]
        [mycad utils]))

(compile 'mycad.default-libs)
(println mycad.default-libs/default-symbols) 

This is the file I’m trying to load, default_libs.clj. The data here will eventually be some xml file, but I’m still pretty new at this, so for now I’ve just written a bunch of clojure maps directly.

(ns mycad.default-libs)
(def default-symbols {.... })

So the question is how can I load a bunch of data from a .clj file without really loading it into the namespace with (ns...) but instead treating it as a source of data using either load or compile?

Thanks for any help

  • 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-06-08T22:15:59+00:00Added an answer on June 8, 2026 at 10:15 pm

    Change the compile in your example into a load as you described it earlier in your question. Then the example will work.

    compile is used for AOT compilation of a namespace. So it is not what you need here.

    In case there is just a single map defined you can use load-file.

    (def default-symbols (load-file "/file/path.clj"))
    

    In case the “file” is actually somewhere on the classpath or by some other non-local stream, there is load-string.

    (def default-symbols (load-string (slurp (io/reader stream))))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Does anyone know how can I replace this 2 symbol below from the string
I'm parsing an XML file, the creators of it stuck in a bunch social
I am trying to loop through a bunch of documents I have to put

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.