Motivation, Links, etc.
Part of my motivation for making this task is frustration that I can't enter the original challenge! On the other hand, it also illustrates a number of interesting techniques (closures, stateful functions) that aren't well-demonstrated on RC yet so it's still useful. And I'm pretty pleased with how well I managed to distill my Tcl solution too.
There are existing solutions at http://www.paulgraham.com/accgen.html and the original essay is at http://www.paulgraham.com/icad.html; overall, this should help people get started with producing implementations. However I also think that this page needs more editing of the heading material so that we're less reliant on Paul's content and instead better linked in with everything else. That's why this is still a draft task.
- You don't have to print the accumulator function. That's just a peculiarity of how some languages work in interactive mode.
- It seems too pointless to create a new accumulator without doing something with it. --glennj 12:50, 29 December 2009 (UTC)
- Strictly according to the rules, the Ocaml code is incorrect, since it isn't polymorphic in the type of number. I'm happier than Paul to let that slide. –Donal Fellows 07:47, 29 December 2009 (UTC)
spec needs fixing
The specification currently requires that our posted solutions take functions which return one value. But no one does this and it does not make sense here. (I would fix this myself but I want a sanity check on my reading.) --11:55, 1 June 2010 (UTC)
- I don't quite understand what you mean here. –Donal Fellows 14:19, 8 June 2010 (UTC)
- The current task says "Before you submit an example, make sure the function 1. Takes, and returns functions that take, exactly one argument." But, to my knowledge, none of the implementations takes a function [as an argument] -- instead they all seem to be taking a number [as an argument] and returning a function of one argument [as a result]. --Rdm 14:55, 8 June 2010 (UTC)