This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Clojure and the fly likes Building Functions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Languages » Clojure
Bookmark "Building Functions" Watch "Building Functions" New topic
Author

Building Functions

mss sanders
Greenhorn

Joined: Feb 15, 2011
Posts: 2
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

Joined: Feb 15, 2011
Posts: 2
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

Joined: Nov 08, 2003
Posts: 3476

Since you are not defining different arities, you can simply drops the parentheses around [ ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Building Functions
 
Similar Threads
Joy of Clojure - Questions
Creating a cartesian product with to lists
unable to remove spaces in xml
Taking the Next Step
JNI crashes my JVM mysteriously