File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Languages » Clojure
Bookmark "Building Functions" Watch "Building Functions" New topic

Building Functions

mss sanders

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

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

Joined: Nov 08, 2003
Posts: 3479

Since you are not defining different arities, you can simply drops the parentheses around [ ]
I agree. Here's the link:
subject: Building Functions
jQuery in Action, 3rd edition