Stories
Slash Boxes
Comments

SoylentNews is people

posted by cmn32480 on Monday December 07 2015, @06:29PM   Printer-friendly
from the way-over-this-editors-head dept.

Recursion schemes are elegant and useful patterns for expressing general computation. In particular, they allow you to 'factor recursion out' of whatever semantics you may be trying to express when interpreting programs, keeping your interpreters concise, your concerns separated, and your code more maintainable.
...
In this article I want to avoid building up the machinery meticulously and instead concentrate mostly on understanding and using Edward Kmett's recursion-schemes library, which, while lacking in documentation, is very well put together and implements all the background plumbing one needs to get started.

In particular, to feel comfortable using recursion-schemes I found that there were a few key patterns worth understanding:

        --Factoring recursion out of your data types using pattern functors and a fixed-point wrapper.
        --Using the 'Foldable' & 'Unfoldable' classes, plus navigating the 'Base' type family.
        --How to use some of the more common recursion schemes out there for everyday tasks.


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 2) by VLM on Tuesday December 08 2015, @12:43PM

    by VLM (445) on Tuesday December 08 2015, @12:43PM (#273303)

    It probably helps that the creator of Clojure, Rich Hickey, seems to have his head on straight in regard to practicality vs. purity.

    There's a recent (within the last month) congitek or cognitecht or cognitechcast or WTF they call themselves podcast that mostly interviews clojure-ish people and is a pretty decent podcast, anyway the topic about two episodes ago was its the orthogonality of design that shows its a good design where you can pick and choose components and there's no systemd-style product tying going on where deciding to use feature A automagically creates dependency hell and you gotta haul in B, C, D, ... X, Y and freaking Z too all because you wanted just "A". At least if the design is orthogonal and good that doesn't happen

    It was the Liberator / Billy Meier episode. Note there is a much more famous Billy Meier in the UFO-ology field AFAIK they are not the same dude. Although that would be funny if it were true. Its a good podcast but I was disappointed however interesting it was they didn't talk about liberator very much which ironically disappointed me because I am mulling around making a REST interface for another group to use, with liberator. For everyone else reading along, liberator is kinda like the router in ring turned up to a million in capability. That's a bad analogy but I've never seen a description of liberator thats shorter than this entire post, so it isn't so bad. Maybe another awful one liner for liberator is it handles all the HTTP-layer BS for you, liberating you from the task of writing something fluent in HTTP protocol, or something. Anyway its a cool interview although it somehow contains almost no liberator content.

    Anyway its just a different way to look at it, that requiring "purity of orthogonality" means you can pick and choose components and its a better worldview than trying "purity of paradigm" which is what you're talking about.

    you can find a lot of Hickey's talks on Youtube

    All the clojure conj too.

    The videos on that list may or may not contain my favorite talk of his which boiled down to why trying to run multi-threaded programs with a non-immutable language is a fools errand. That might or might not be the "Are we there yet" talk.

    Hammock driven development is a good video. Its general enough that it could nearly be unleashed upon the normies at a TED talk.

    Starting Score:    1  point
    Karma-Bonus Modifier   +1  

    Total Score:   2  
  • (Score: 0) by Anonymous Coward on Tuesday December 08 2015, @05:00PM

    by Anonymous Coward on Tuesday December 08 2015, @05:00PM (#273490)

    The videos on that list may or may not contain my favorite talk of his which boiled down to why trying to run multi-threaded programs with a non-immutable language is a fools errand.

    If it really boils down to that, I don't need to see it. It's bullshit. Anything you don't share between threads is no more complicated in multi-threaded programs than in single-threaded ones. That especially includes local variables of automatic storage duration (such as loop counters for iterative implementations of algorithms).