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 using juxt to run multiple 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 "using juxt to run multiple functions. " Watch "using juxt to run multiple functions. " New topic

using juxt to run multiple functions.

jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
Hi guys :

I have a clojure script, the purpose is to do a whole bunch of "stats" on a JSON, just for experimenting with the
flexibility of text analysis stats in Clojure.

I also tried adding "apply" before juxt and that failed.

Sean Corfield
Ranch Hand

Joined: Feb 09, 2011
Posts: 252

Your opening paren is in the wrong place - remember paren comes before the function, not after it:

You need partial here or an explicit function since you're taking away the last argument (data). It might be cleaner to define each function upfront:

Also note that your parenthesis style is not idiomatic - you're laying out your parens like braces in Java (which is why I think you end up putting them in the wrong place). Try to get used to the more idiomatic layout I'm using where you use small indentation and stack trailing parens on the same line.
It is sorta covered in the JavaRanch Style Guide.
subject: using juxt to run multiple functions.
Similar Threads
how to implement : key + " = " + get(key)
Function with many arities
Will Clojure be popular among Java programmers?
Taking the Next Step
JEE Enterprise Market scenario and Clojure