Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Clojure, what are the other most important functions in Clojure core one must master to be productive?

Other than map, filter, reduce , of the numerous other functions in clojure core, which are the next set of most useful/commonly used functions that I must learn to be productive ?

like image 413
user193116 Avatar asked Aug 17 '12 19:08

user193116


4 Answers

If you go to the 4clojure problems page and search for "core-functions", you'll find a bunch that the 4clojure team finds useful. To name a few:

  • group-by
  • distinct
  • reductions
  • frequencies
  • partition
  • merge-with
  • interleave
  • interpose
like image 104
dbyrne Avatar answered Oct 31 '22 21:10

dbyrne


The sequence processing library is a lot of what to me makes Clojure Clojurish. This idea being to have many functions on a single datatype rather than a few functions on a few types. so I would say that learning all the sequence manipulation functions can have a huge benefit.

ps: a special shout out for for, reductions, and iterate

like image 40
Arthur Ulfeldt Avatar answered Oct 31 '22 21:10

Arthur Ulfeldt


The cheatsheet is useful: http://clojure.org/cheatsheet, and doesn't take very long to read.

like image 6
Kevin Avatar answered Oct 31 '22 22:10

Kevin


Your list of map, filter, and reduce covers some of the biggies, so adding to that list would probably duplicate what you already know.

One of Clojure's strengths is synchronization. I would start writing sample code to learn how to use those synchronization constructs, refs, agents, and atoms. A lot of the Clojure books cover it. I know Clojure in Action covers these quite well.

I would work with maps, though I am not specifically referring to a function, but to why maps are good in general as well as multimethods.

Finally, I would work with why you sometimes do need to use loop .. recur. The advice I have gotten over the past 1+ years has been very sound. Use it when you absolutely have to.

like image 4
octopusgrabbus Avatar answered Oct 31 '22 20:10

octopusgrabbus