On Wednesday, April 10, 2013 7:54:37 PM UTC+2, Luc wrote:
>
> I can safely assume that the input state is also a set. 
>

This emphasizes the toughest aspect of comprehending Clojure code: it is 
not at all about conciseness or FP, but about dynamism. We just don't know 
what value has what type so we develop hypotheses and see how they stand 
up. Here, *cells* is the last argument to *mapcat* so it must be 
seqable---clue number 1. *cells* is also a function accepting *loc* as 
argument---clue number 2. So it could be a map, a set, or a vector. We 
eliminate vector because (*cells loc*) doesn't make a lot of sense against 
a vector. So... is it a map or a set? It could be either. Is *loc* of the 
same type as the element type of *cells*? Could be---if yes, then *cells* would 
fit the requirements for a set. Otherwise *cells* could also be a map from *
loc* to some *cell* type that this code doesn't use.

With that in mind, I must comment that, at least to my eyes, this is a 
perfectly comprehensible piece of code, quite transparent in fact---as 
transparent as Clojure gets. Under no criterion can this be classified as 
obfuscated code because it doesn't play any tricks with the human 
reader---in every detail it is an idiomatic, natural representation of the 
problem it is solving.

-marko

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to