Yuce's Blog

Cognitive dissonance is yoga for the brain.*

Accumulator Generator


In his accumulator generator page, Paul Graham compares several languages to solve a particular problem that is quoted below (apparently, he has chosen this example in favor of his new Lisp-like language Arc):

The problem: Write a function foo that takes a number n and returns a function that takes a number i, and returns n incremented by i.

Note: (a) that's number, not integer, (b) that's incremented by, not plus.

My trial with Marvin was a failure, and could not satisfy all the 5 requirements given here. But now with Marvin2 (a rewrite of the language) this can be accomplished with the following line:


marvin, accumulator generator, Paul Graham