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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:32:38+00:00 2026-06-01T04:32:38+00:00

I have a small code that doesn’t want to work at all when I

  • 0

I have a small code that doesn’t want to work at all when I perform a loop like the following:

...

    (defn my-function []
        (println "Hi")   ;this works
        (for [i (range 10)] (println "Hello")  ;this doesn't work!
          )
    )

...

I can’t understand what the problem is, all the code inside the loop seem to be ignored, while the “Hi” print without problems

I call ‘myfunction’ through a GUI button event, like this:

...
    (.append output-text (with-out-str  (time (my-function))))
...

Do you think the problem could reside in the GUI or something else I am missing? Any suggestion?
I know I should use the REPL to test it but it doesn’t work with Netbeans… :S

Thanks very much for your 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-01T04:32:40+00:00Added an answer on June 1, 2026 at 4:32 am

    The for macro is lazy, so it will not invoke your function unless the return value is actually needed.

    Use the doseq function instead. It will force the evaluation of your code, and thus is not lazy. It has the same “syntax” as for and allows you to account for side effecting functions such as println.

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

Sidebar

Related Questions

I have this small code library that I'm considering releasing into Open Source. I
I have a small code block that should append text to the beg of
I have a small piece of code that works as a plugin for a
I have a small html code base that produces a list of unique links,
I have a small snippet of code below that I'm running using PellesC .
I have a small function that will take a string of css (eg background:
So, I have a small bit of javascript code that makes a popup div.
Desired effect I have a bunch of small images that I'd like to show
Using Rails 3.0, I have a small bit of code that I seem to
I have a small code base using Subsonic 2.1 in my project. I would

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.