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 6985023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:37:34+00:00 2026-05-27T18:37:34+00:00

So I have the following function which works well when called from the REPL:

  • 0

So I have the following function which works well when called from the REPL:

(defn plot-data-files
  "Produces a file with x-axis values on 1st column and y-axis values on the
  2nd column"
  []
  (let [filename (user-input "file to which you want to write plot output")
        x-values file-data-days
        y-values (get-dndtf)
        file-writer (new java.io.FileWriter filename)]
    (if (= (first y-values) za-not-found)
      (println za-not-found)
      (for [index (range (count x-values))]
        (binding [*out* file-writer]
          (prn (Double/parseDouble (str (nth x-values index)))
               (Double/parseDouble (str (nth y-values index)))))))))

However, when I try using Leinigen to produce a jar file, the function no longer writes to files. So I tried calling -main from the REPL, and sure enough, the function also does not write to files, even though it does when called by itself. So, I tried defining another function:

(defn call-plot-function
  "Basically calls the plot function, plot-data-files"
  [] (plot-data-files))

and sure enough, it works. I try calling -main again, but this time calling call-plot-function instead of plot-data-files directly:

(defn -main [& args]
  (get-all-file-data)
  (while (not (= \n (first (user-input "whether you want to output more plot
  files"))))
    (call-plot-function)))

And again, plot-data-files magically does not write file output when -main is called. What should I be doing here?

  • 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-27T18:37:34+00:00Added an answer on May 27, 2026 at 6:37 pm

    for is not a loop. Your -main is returning a lazy sequence, and you never force any of its elements. The repl forces in order to print, which is why you see the difference. If you want side effects instead of a sequence, doseq has otherwise the same semantics as for.

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

Sidebar

Related Questions

I have the following function which works very well within a $(document).ready(function(){ $('.threadWrapper >
I current have the following which works well: channel.bind('pusher:subscription_succeeded', function(members) { members.each(set_status_online); }) function
I have the following chart in column format which works well: $(document).ready(function() { get_data();
I have the following script which works well: $(that).parents(.portlet).fadeOut('slow', function() { $(that).parents(.portlet).remove(); }); It
I have the following script which works fairly well: $(.btnMinimize).live('click', function(event) { event.preventDefault(); $(
Assuming I have the following two JQuery functions - The first, which works: $(#myLink_931).click(function
So: I have the following function, adapted from a formula found online, which takes
In my .vimrc file, I have the following function, which folds the licensing information
I have following piece of code which tries to load an XML file from
Let's say I want to have a function which reads data from the SerialPort

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.