6 ms·
Show HN: Clojure by Example
- abc_lisper 11y agoGood job Man! Bookmarked.
- josebaezmedina 11y agoIt reminds me to http://learnxinyminutes.com/docs/clojure/ http://learnxinyminutes.com/docs/clojure/ but prettier.
- maelito 11y agoVery pleasant to read
- jonnybgood 11y agoWould be awesome if interactive like the interactive SICP[0] [0] http://xuanji.appspot.com/isicp http://xuanji.appspot.com/isicp
- fierycatnet 11y agoWoah. I've been wanting to finish SICP book along with MIT lectures and this site looks like another great addition. This gives me a boost in motivation to finish the book. If someone ever comes up for something like this for Clojure then it would be incredibly awesome.
- elangoc 11y agoWhoa! ISICP looks really cool! You know, the exercise sections of ISICP remind me a lot of the interactive Clojure exercises at 4Clojure.com. 4Clojure.com has a link to the github repo of the software used to create the site.
- hajims 11y agoThis should be posted over to r/clojure
- icey 11y agoThat's a great idea; just posted it over there and added it to the sidebar.
- elwell 11y agoLooks cool. Code indentation error/confusion at http://kimh.github.io/clojure-by-example/#future http://kimh.github.io/clojure-by-example/#future though.
- fierycatnet 11y agoCool, thanks! Looks like a nice reference.
- nerd_stuff 11y agoThis 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-clojure http://stackoverflow.com/questions/1774417/scoping-rules-in-...
- fnordsensei 11y agoThis would be better for illustrating that object is not overweritten, I think: =>(let [object "light"] => (let [object "darkness"] => (println (str "God said let there be " object))) => (println (str "God said let there be " object))) God said let there be darkness God said let there be light nil
- kimh 11y agoThanks for this. I added your example with slightly different form!
- deleted 11y ago[deleted]
- kimh 11y agoThanks for your feedback! I think I could make it better. http://kimh.github.io/clojure-by-example/#scope http://kimh.github.io/clojure-by-example/#scope
- hoprocker 11y agoLovely. A nice addition would be a floating REPL to try things out as you go along, maybe at the bottom of the screen with a dash of transparency. (I know I know, there are plenty of other ways to access a Clojure REPL!)
- lewisl9029 11y agoFor those who prefer learning in a more passive manner, I've found these sets of screencasts on the Clojure Koans quite useful too. http://www.clojurescreencasts.com/koans-walkthrough/01.html http://www.clojurescreencasts.com/koans-walkthrough/01.html
- melipone 11y agoRemind me of the little schemer. How about a "The little clojurist" book?
- mayneack 11y agoThis is super helpful. Reminds me of bropages: http://bropages.org/ http://bropages.org/
- pvdebbe 11y agoGreat execution, but the indentation is wonky at times, making it difficult to see the idea.
- dvliman 11y agothis is exactly how intro to programming language should be (for people who already know other languages)
- elangoc 11y agoI love it! The target audience is people with prior programming experience. It's important to know the target audience, either as a writer or reviewer. The tutorial webpage is simple and effective with a gradual progression in concept difficulty. I hope we have more things like this! Thanks!
- thomas11 11y agohttp://www.4clojure.com/ http://www.4clojure.com/ should also be mentioned here. I had a lot of fun there.
- TickleSteve 11y agoClojure has always been slightly disappointing for me... The principles behind its design are all sound and Rich Hickey deserves credit for putting in the hard thought behind it. ... but.... the reality seems to be of a really under performing language. The forums are consistently full of people with 'why is this slow?' to which the solution is always 'Give it more hints' or 'do it in a more Java like way'. Unfortunately the Clojure stack seems not to have much mechanical sympathy (despite its best intentions). It seems the natural/idiomatic way to use Clojure results in far too much dynamic behavior to be performant. Clojure may scale well, but its inherent bad performance (without lots of work) is a major downside. I forget who said this, but it seems very appropriate to Clojurists... "Show me you can use one machine well before you get another..."
- codeshaman 11y agoI aggree. I love the language and concepts, but at some point, after two months of learning it, I've got fed up with the slugishness of the whole thing and gave up because I have no idea what to do with it. I also found it a very difficult language to learn. I felt like I was taking baby steps every day, although I was giving it all I could. I felt stupid and frustrated to the point that I'm actually considering quitting the profession, because, well, I'm not good enough for this. Contrast that with Objective-C which I learned last year - it took me a couple of weeks to become profficient and start writing real world, commercial apps which I can sell. Maybe 15 years of daily C++ programming has had something to do with it, but still. I struggle to imagine a practical project which I could use clojure for. Front end, user-facing apps, utilities, system tools - forget it - an app takes 15 seconds to load and uses gigabytes of RAM. Backend - maybe, but there are a lot of other languages and frameworks out there which are really powerful and have huge communities. So I don't know, I really love clojure, but the JVM just doesn't cut it for me. I want a C++ version of Clojure, which I was thinking about starting every single day I was learning it.
- dasmoth 11y agohttps://github.com/pixie-lang/pixie https://github.com/pixie-lang/pixie could be worth a look. That said, "add more type hints" hasn't generally been my experience of Clojure. If anything, it tends to be an indication that you've already gone a bit far down the path of "doing things the Java way".
- kimh 11y agoIf the site looks cool and slick to you, then you should give a star to https://github.com/tripit/slate https://github.com/tripit/slate which I used to create the site. I found Slate is very easy to use and customize!!