Talk:Closures/Value capture: Difference between revisions

What happens if the list is as follows?
(→‎Sample output: function description)
(What happens if the list is as follows?)
Line 7:
: A bit more specification/clarity would be helpful. I think I understand, but I shouldn't have to read one of the code examples to be sure.
::The description "such that the function at index i (i from 0 to 9), when run, should return the number i." sounds like the function just returns its argument. It says nothing about how the return value behaves. It looks like we are meant to use a closure to create what is effectively a constant.
:::I misinterpreted this as its parametric position at first, but I think it means its position within a list. What happens if the list is as follows?: a(), b(), a(),
Should the first a() give 1, b() give 2, and the second a() give 3? [[User:Markhobley|Markhobley]] 12:06, 20 July 2011 (UTC)
:: Why 10 functions? Surely two or three would be sufficient to demonstrate how this works? The python example seems to put these in a list.
--[[User:Dgamey|Dgamey]] 11:46, 20 July 2011 (UTC)