Hrvoje Niksic <[EMAIL PROTECTED]> writes: > Douglas Alan <[EMAIL PROTECTED]> writes:
>> I think you overstate your case. Lispers understand iteration >> interfaces perfectly well, but tend to prefer mapping fuctions to >> iteration because mapping functions are both easier to code (they >> are basically equivalent to coding generators) and efficient (like >> non-generator-implemented iterators). The downside is that they are >> not quite as flexible as iterators (which can be hard to code) and >> generators, which are slow. > Why do you think generators are any slower than hand-coded iterators? Generators aren't slower than hand-coded iterators in *Python*, but that's because Python is a slow language. In a fast language, such as a Lisp, generators are like 100 times slower than mapping functions. (At least they were on Lisp Machines, where generators were implemented using a more generator coroutining mechanism [i.e., stack groups]. *Perhaps* there would be some opportunities for more optimization if they had used a less general mechanism.) CLU, which I believe is the language that invented generators, limited them to the power of mapping functions (i.e., you couldn't have multiple generators instantiated in parallel), making them really syntactic sugar for mapping functions. The reason for this limitation was performance. CLU was a fast language. |>oug -- http://mail.python.org/mailman/listinfo/python-list