Show HN: Clojure by Example
kimh.github.io
Show HN: Clojure by Example
1–10 of 37 posts
Re: Show HN: Clojure by Example
#2Good job Man! Bookmarked.
Re: Show HN: Clojure by Example
#3It reminds me to http://learnxinyminutes.com/docs/clojure/ but prettier.
Re: Show HN: Clojure by Example
#4Very pleasant to read
Re: Show HN: Clojure by Example
#5Would be awesome if interactive like the interactive SICP[0]
Re: Show HN: Clojure by Example
#6This should be posted over to r/clojure
Re: Show HN: Clojure by Example
#7Looks cool. Code indentation error/confusion at http://kimh.github.io/clojure-by-example/#future though.
Re: Show HN: Clojure by Example
#8This should be posted over to r/clojure
That's a great idea; just posted it over there and added it to the sidebar.
Re: Show HN: Clojure by Example
#9Cool, thanks! Looks like a nice reference.
Re: Show HN: Clojure by Example
#10This is a great project!
I believe there's a lack of clarity in the let form explanation:
=>(let [object "light"]
=> (let [object "darkness"])
=> (println (str "God said let there be " object)))
God said let there be light
nil
'object' is overwritten but only within the second let form: =>(let [object "light"]
=> (let [object "darkness"]
=> (println (str "God said let there be " object))))
God said let there be darkness
nil
or even: =>(let [object "light"]
=> (println (str "God said let there be " object))
=> (let [object "darkness"]
=> (println (str "God said let there be " object))))
God said let there be light
God said let there be darkness
nil
The reason for this is the let form uses lexical scoping. In other words it creates a new frame which includes the bindings declared in the square brackets. When 'object' is evaluated its binding is looked for in the current frame, then the frame that called that frame and all the way out into the global namespace stopping when a binding is found.See also: http://stackoverflow.com/questions/1774417/scoping-rules-in-...