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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:24:46+00:00 2026-06-04T16:24:46+00:00

In Python, you can pass a list or tuple to a function and have

  • 0

In Python, you can pass a list or tuple to a function and have the function unpack the argument. How can I do that in Clojure? Here is some example Python code:

def f (a, b, c, *d):
    print "a: ", a
    print "b: ", b
    print "c: ", c
    print "d: ", d

f (1, 2, 3, 4, 5, 6)

print
v = (4, 5, 6)
f(1, 2, 3, *v)

result:

a:  1
b:  2
c:  3
d:  (4, 5, 6)

a:  1
b:  2
c:  3
d:  (4, 5, 6)

in my clojure code:

(defn f [a b c & d]
  (println "a: " a)
  (println "b: " b)
  (println "c: " c)
  (println "d: " d))

(f 1 2 3 4 5 6)

(println)
(def v [4 5 6])
(f 1 2 3 v)

result:

a:  1
b:  2
c:  3
d:  (4 5 6)

a:  1
b:  2
c:  3
d:  ([4 5 6])

the d have one element only, how can I let result as python code?

  • 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-04T16:24:48+00:00Added an answer on June 4, 2026 at 4:24 pm

    Clojure does not unpack arguments from a vector with a language feature, like Python does.

    The closest thing to unpacking is function apply.

    In this particular case:

    (def v [4 5 6])
    (apply f (concat [1 2 3] v))
    

    Prints:

    a:  1
    b:  2
    c:  3
    d:  (4 5 6)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Python list variable that contains strings. Is there a function that
I have some a list comprehension in Python in which each iteration can throw
In a function that expects a list of items, how can I pass a
In python, when you have a list of tuples, you can iterate over them.
I have a function that parses a file into a list. I'm trying to
I have a Python function which takes several arguments. Some of these arguments could
How can I bind arguments to a Python function so that I can call
Simple question: How can I pass an arbitrary list of args to a python
In python the * allows me to pass a list as function parameters: def
I have a problem with python here. If I pass an array through a

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.