Hacker News new | past | comments | ask | show | jobs | submit login

Since you use () for more or less everything in Lisp, from declaring functions or records(structs) to calling functions or doing comparisons (<, >, =, etc. are functions in Lisp), you will always get a clump of ) at the end of something.

In Java, if you have a class containing a function which itself contains an if-statement containing multiple lines. You will have three lines at the end of the file containing nothing but }. There is no reason you couldn't clump those together and thus end the last statement in your function with }}}.

The difference is, in Java it's good practise to give each } a seperate line. In Lisp, most people prefer to clump their ) together.

Also, you could easily end a function with alot of )))))).

(defn unique-large-squares [list-of-nums] (count (unique (filter #(> % 100) (map #(* % %) list-of-nums)))))

Of course, if the clump of ) are off-putting, you could always use ->

(defn unique-large-squares [list-of-nums] (-> list-of-nums (map #(* % %)) (filter #(> % 100)) (unique) (count)))




I imagine yogthos was referring to this, but the clump of `)))))` itself is only a symptom of the real problem: that you've got too much nested logic.

`)))))` at the end of a function doesn't matter. The function's over. Even if you needed to make a change that would break the clump up, you generally navigate it from the opening side.

But if it's at the end of a fat true-expression of an if-statement, you probably have to add a `;; x is false` comment to remind yourself what's going on by the time you get to the false-expression.

Just like in Python when you get to an `else:` yet you have to scroll up just to find the matching `if` because somebody decided to roll their own SOAP client on the true path.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: