News for hackers. Stuff that matters.
Re:PG: If starting Viaweb today, would you use Lisp? by andersholtsberg on Saturday July 28, 2007 @04:25PM (#37334)
It is rather interesting to look at Paul's list of implementations of an accmulator in different languages:

http://www.paulgraham.com/accgen.html

In my very biased and unlearned view the simplest readable versions are Javascript and Lua. And Lua has server side libraries for CGI and SQL and other goodies (search for Xavante on the net). Just a tip for those poking around for readable and clean language alternatives. And Lua just got up to position 18 on the Tiobe index this month.

http://www.tiobe.com/tpci.htm

Hackers and Paiter page 161, The hundred years language:

"How far will this flattening of data structures go? I can think of possibilities that shock even me, with my consiously broadened mind. Will we get rid of arrays for example? After all, they're just a subset of hash tables where the keys are vectors of integers."

Lua does exactly this. And is quite efficient anyway.

Anders Holtsberg

Re:PG: If starting Viaweb today, would you use Lisp? by portLAN on Saturday July 28, 2007 @07:39PM (#37356)
> In my very biased and unlearned view the simplest readable versions are Javascript and Lua.

The Python version listed there doesn't actually meet the requirement (it doesn't return a function, it returns a class instance, and it keeps modifying n every time it's called).

Corrected version:

  def foo(n): return lambda (i): n+i
Which is essentially identical to the Common Lisp version.
Re:PG: If starting Viaweb today, would you use Lisp? by earthboundkid on Sunday July 29, 2007 @06:09AM (#37428)
If it's supposed to be an accumulator, I take it they want the value of n to be changed each time. I'd do:

    def acc(n):
        while True:
            n += yield n
Re:PG: If starting Viaweb today, would you use Lisp? by portLAN on Sunday July 29, 2007 @09:03PM (#37533)
But emphasizing correctness makes my one-liner not work! And reading the original I can see this whole issue was already covered!

BTW, generators are non-callable.