Skip to content
Fold right and then left in JavaScript
JavaScript HTML CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
YUI
beyond/dotted_string
doc
lib
.gitattributes
.gitignore
LICENSE
README.md
YUIGeiesfolds0.1Test.htm
archive.js
dotted_string.htm
geiesfolds_0.1.js
geiesfolds_0.1Test.js

README.md

geiesfolds ( j-s-folds)

Here are the tests.

PRE-RELEASE 0.1

Crisp clear JavaScript folds. This repository relies on geieslists for handling functions like cons, head/car, tail/cdr.

It features the translation c/q adaptation in JavaScript of the Haskell examples from 1) and 2), plus the Scala examples from 3).

All this while throwing in some original experiments and links to other functional matters like tuples and continuations.

This project is presented at:

http://faustinelli.wordpress.com/2013/09/10/fold-right-in-javascript/ http://faustinelli.wordpress.com/2010/04/22/foldleft-foldright/

I know this JavaScript code is just a bunch of global stuff, but it's not meant to be used as-is in a production environment.

ORIGINAL CONTRIBUTION

Getting to master fold right is a very difficult undertaking. I have found plenty of fold left blog examples, but very little about fold right. Let alone in JavaScript.

The main idea is to present a series of examples of increasing difficulty, illustrating new FP techniques along the way.

In the case of fold right there are also two original contributions, get n and archiveBuilder (the latter still WIP).

There are a few original examples of fold left in the code, but they aren't yet commented in the blog page. Fold left is easy, though. And there are plenty of sources out there.

DEBITS AND CREDITS

I am in deep debt with:

  1. Graham Hutton - "A tutorial on the universality and expressiveness of fold"

  2. "Real World Haskell", O'Reilly

  3. http://oldfashionedsoftware.com/2009/07/30/lots-and-lots-of-foldleft-examples/

Any feedback is welcome.


Released under MIT License.

You can’t perform that action at this time.