Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does coll stand for collection in clojure?

Tags:

clojure

I have been running into the term coll, and have just been assuming it means collection or list. But we all know what they say about assuming. Just looking for a little clarification.

like image 796
Jason Basanese Avatar asked Dec 14 '22 12:12

Jason Basanese


1 Answers

Yes, coll is a common name for a collection parameter in clojure code.

Here's the list of idiomatic names from the (unofficial) Clojure Style Guide:

in functions:

  • f, g, h - function input
  • n - integer input usually a size
  • index, i - integer index
  • x, y - numbers
  • xs - sequence
  • m - map
  • s - string input
  • re - regular expression
  • coll - a collection
  • pred - a predicate closure
  • & more - variadic input
  • xf - xform, a transducer

in macros:

  • expr - an expression
  • body - a macro body
  • binding - a macro binding vector

There's a similar but shorter list in the Library Coding Standards page in the clojure developers wiki. While not every clojure developer agrees on their entire contents, both are good readings. Just take them with a grain of salt: "rules are made to be broken"

like image 61
nberger Avatar answered Jan 24 '23 16:01

nberger