Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

cloojure
Copy link
Contributor

@cloojure cloojure commented Jun 5, 2014

Although a comma is considered whitespace in clojure, it is usually easier to read if a space char is used instead of a comma to separate various elements (such as in a vector).
Alan

@qtrfeast
Copy link
Member

qtrfeast commented Jun 6, 2014

I don't know that I feel the same way in this case. I always felt like collections of strings read very badly without commas.

@cloojure
Copy link
Contributor Author

cloojure commented Jun 6, 2014

I have felt that way sometimes, although I often think blanks sometimes provide a better visual delimiter. In this specific case, since the strings themselves contain commas (2nd example), it is not obvious which commas are delimiters and which are part of the data.

Even in java code, I would almost always write something like "foo( firstParam, secondParam, thirdParam )" instead of "foo(firstParam,secondParam,thirdParam)", since the spaces seem (to me) to make the symbols jump out visually, while the commas tend to blend-in a bit. Migrating to clojure, the commas are now redundant with the spaces so I would write "(foo firstParam secondParam thirdParam)".

For really complex parameters, I will often just put each param on a separate line to make it obvious where one ends and the next begins:

(foo  my-first-big-long-param
      #(reduce some-fun {} (bar a b c))
      [and-yet-another complicated-param eter] )

Alan

@qtrfeast qtrfeast closed this in dda3b46 Jun 9, 2014
@qtrfeast
Copy link
Member

qtrfeast commented Jun 9, 2014

Becuase they are lines in this case, I've changed the commas to newlines. Thanks for bringing this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants