This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Building Functions

 
mss sanders
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks!

Question... (very much a Clojure newbie) but, how do I wrap the following in a stand alone function?



My problem (I'm thinking) is that when I attempt to wrap the above in its own function, Clojure seems to insist that I ought to pass arguments to the function. In fact, I want to pass zero arity (no args).
 
mss sanders
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe I've got it up & running now... The 'trick' was to wrap the empty vector list in their own parenthesis ([]), as shown below:



So for the false alarm there...
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you are not defining different arities, you can simply drops the parentheses around [ ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic