5 ms·
Functional JavaScript: Closure
- tieTYT 13y agoAs it says on the site, Fogus is "a core contributor to Clojure and ClojureScript". I wonder why he didn't just write a book on ClojureScript instead. Isn't ClojureScript already a way to write functional javascript?
- fogus 13y agoI am writing a book on ClojureScript. http://joyofclojure.com/2nd http://joyofclojure.com/2nd
- owenjones 13y agoHa! Thanks for the new book fogus, love TJoC 1 and am eagerly awaiting the sequel.
- zura 13y agoNice! I hope "Thinking code" and "Data-orientation" parts will get more attention (and space), versus ClojureScript and "weby" stuff, in case there will be a trade-off.
- sivam 13y agoThank you for your contributions to Clojure, it's a great step forward among all the other procedural languages around.
- shawnz 13y agoJavascript is inherently functional on its own! I can't speak for the author, but I suspect he titled it this way because of how few javascript users there are that actually understand this fact.
- Fistandantilus 13y agoJavascript is inherently dis-functional (hehe) as it relies heavily on mutation and side-effects, rather than immutability and functional purity. First-class functions do not mean the language is functional.
- tieTYT 13y agoI disagree with this statement. Arrays are mutable, it's easy to make global mutable state, for the longest time for loops required a mutating index, etc.
- Torn 13y agoWhich for loops don't require a mutating index? (apart from the object property "for __ in __" iterator)
- tieTYT 13y agoThose ones. But what I meant was that it is idiomatic to use for loops vs recursion.
- michaelsbradley 13y agoThat's true, and may be reinforced somewhat by the fact that JavaScript doesn't eliminiate tail calls. In other words, there are situations where a recursive algorithm would be clean and compact, but might result in the call stack being blown inadvertently. I ran into this recently while building a "practical" monads library for JavaScript. Each monad and transformer has sync and async variants. The sync variants can't use straight recursion because "deep" monadic binds will result in a blown call stack. The solution was/is to allocate on the heap in terms of an array that acts as a manually operated call stack (I think I essentially implemented a "trampoline" but I'm not 100% certain).
- mackwic 13y agoConsidering that recursive loop with bounds is a sort of for loop, recursive for.
- MatthewPhillips 13y agoThe Joy of Clojure is my favorite programming book, so this is a no brainer for me.
- arielserafini 13y agoI'm currently reading it and enjoying it a lot. Congrats!
- deleted 13y ago[deleted]
- tonetheman 13y agoCongrats, I have been waiting a while for this!
- matt__ring 13y agoI'm a back end java guy who's getting more into JS. Bought. Thx, Fogus.
- recuter 13y ago$12 is cheap. I also made sure it went through your Amazon referral link fogus, thank you for writing it. :)
- mark_l_watson 13y agoI did the same thing. I have been waiting for this book. For a variety of reasons, I have been spending more time coding in Javascript and a little less in Clojure, and I hope this book helps make that a happier experience.
- akurilin 13y agoThoroughly enjoying your book, thanks for writing it! It was also great to get a DRM-free copy through O'Reilly. Please write more :)
- guiomie 13y agoHow does this book compare to Doug Crawfords book?
- oneeyedpigeon 13y agoThe otherwise beautiful 'official site' has a very curious 'feature' right at the bottom: a glossary of choice words which, on click, pop open a window alert with their 'definition'. It gets even more bizarre: at least two of those items return "glossary entry for [xyz] not yet available".
- fogus 13y agoAnd? Actually one definition, 'recursion' reloads the page and the other 'laziness' has no definition... yet.
- derengel 13y agoThank you for creating this book!
- olalonde 13y agoThe book is on sale here: http://shop.oreilly.com/category/deals/velocity-celebration.do?code=CFVLCTY&cmp=tw-velocity-dotw-velocity-celebration-promo http://shop.oreilly.com/category/deals/velocity-celebration.... (50% discount)
- swah 13y agoThat seems to be the ebook.
- d0m 13y agoSo far I've been disappointed by the "functional X" books.. Probably because I've read SICP and much of the "functional" books just repeat the same patterns over and over.. i.e. memoization, closures, map, reduce, etc. Still, I'm a sucker for these books and I'll gladly buy it. Hopefully I'll learn a thing or two.. and if I do so, I'll be more then happy to share the word about it! : )