Hacker News new | past | comments | ask | show | jobs | submit login
Foldl and foldr considered slightly harmful (docs.google.com)
48 points by raganwald on Feb 10, 2010 | hide | past | favorite | 15 comments



I posted this previously: http://news.ycombinator.com/item?id=814632

The highlight of the discussion (if you ask me) was this video link of Steele giving this talk at ICFP:

http://www.vimeo.com/6624203


Well, I'm convinced! No more cons lists for me.

There are other benefits to programming techniques built around general catamorphisms, too! For instance, by abstracting all recursion into the catamorphism framework, the destructor function that does all the heavy lifting can often be easily expressed in a subset of the language that contains only total functions (that is, functions that always produce a valid result in finite time), allowing (comparatively) simple proofs of correctness.

This also pairs well with the mirrored approach of building (potentially infinite) data in an "on demand" manner. Abstracting the corecursion into the anamorphism likewise allows the constructor functions to often be total.

Turing-completeness is overrated!


That was so far over my head I'm not even sure I have a head anymore.


Is Google Docs now the new scribd when it comes to PDF links on HN? Give the real URL and note that it is a PDF in the title!


Give the real URL and note that it is a PDF in the title!

Agreed. Personally I much prefer Google's viewer to scribd (no flash!) but I’d still rather a link to the original pdf. I can (and do) add my own Google viewer links in with greasemonkey ( http://www.cs.toronto.edu/~murray/code/#googleviewer ).


Sorry, I was just passing the link along as it was passed to me. I have no objection to someone else reposting it or to a moderator modifying the link here.


I would never have noticed. I've been using the Chrome extension to open PDFs in Google docs for weeks now. Chrome is now my preferred PDF reader. It is fast, usable, and lives where I live: in my browser.


Where do I find this plugin? A quick search doesn't find any useful results.


Maybe he meant: https://chrome.google.com/extensions/detail/nnbmlagghjjcbdhg... ? For me that’s the top hit at http://www.google.com/search?q=chrome+extension+pdf

The greasemonkey script I linked above behaves a bit differently, but also works in Chrome.


Yup, that's it.



Very clear thinking there. I suppose this may be old hat for some people, but I found it informative.


It seems like a pretty logical step to go from cons cells to these conc structures. I wonder if Rich Hickey knows about this and can get it into Clojure somehow (if it isn't already being used somewhere). It seems like a perfect fit for Clojure.


There's a good overview of how persistent vectors are implemented in Clojure here - http://blog.higher-order.net/2009/02/01/understanding-clojur...


Clojure is an example given in the presentation; its immutable lists are actually 64-way trees. (Or so the talk says; I thought it was vectors that were implemented as trees.)




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

Search: