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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:08:25+00:00 2026-05-15T23:08:25+00:00

I want to be able to do the following pseudocode: Pass in symbol a.

  • 0

I want to be able to do the following pseudocode:

  1. Pass in symbol a.
  2. Pass in symbol b.
  3. Pass in an expression using a and b
  4. As I change the value of a and b, print the output of c at each moment.

Ideally, I would like the signature to look like:

(runner a b (+ a b))

but I’m not sure that I’m approaching this correctly… I’ve tried changing the function to

(runner 'a 'b (+ 'a 'b))

and this more complicated example:

(runner 'a 'b (+ (* 'a 'b) 'a))

but this does a + on ‘a and ‘b before stepping into runner.

Here’s my first stab at some clojure:

(defn runner [a b c] (
  (for [i (range 10)
        j (range 10)] (println i j (c i j))

What concept of clojure am I missing?

  • 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-15T23:08:26+00:00Added an answer on May 15, 2026 at 11:08 pm

    Function arguments are always evaluated before the function is called. If you want to defer evaluation or represent some computation or code as an object, you have a few options:

    1. Use a function (see my code below)
    2. Use a macro and splice some code into some other code that the macro generates
    3. Pass code as a quoted list, and eval it.

    Using a function is what you want to do 99% of the time. 1% of the time, you’ll want macros. You should never need eval unless you’re generating code at runtime or doing very screwy things.

    user> (defn runner [f]
            (doseq [a (range 3)
                    b (range 3)]
              (println a b (f a b))))
    #'user/runner
    user> (runner (fn [x y] (+ x y)))
    0 0 0
    0 1 1
    0 2 2
    1 0 1
    1 1 2
    1 2 3
    2 0 2
    2 1 3
    2 2 4
    

    This could also be written as (runner #(+ %1 %2) or even simply (runner +).

    There is no need to pass “a” and “b” into the function as arguments. doseq and for introduce their own local, lexically scoped names for things. There’s no reason they should use a and b; any name will do. It’s the same for fn. I used x and y here because it doesn’t matter.

    I could’ve used a and b in the fn body as well, but they would have been a different a and b than the ones the doseq sees. You may want to read up on scope if this doesn’t make sense.

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

Sidebar

Related Questions

I want to be able to achieve the following using guice/gin: Get all sort
I want to be able to parse the following times using ParseExact() function: 01:02:03
I want to be able to compare the two following objects for likeness using
I want to be able to run the following command using maven mvn tomcat7:deploy
I want to be able to do the following class Parent: def __init__(self): pass
I want to be able to do the following actions with a form submit
I want to be able to do the following: NSString *hoursAndMinutes = [myNSDateObject formattedTime];
I want to be able to do the following: get '/:slug' do haml :page
I want to be able to initialize a CArticle having the following properties: Private
I have the following migration and I want to be able to check if

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.