News for hackers. Stuff that matters.
Re:Functional programming in Python by rbonvall on Friday May 11, 2012 @06:52PM (#3961865)

    One thing I love about Lisp is that it's
    ridiculously easy to write (cons item some-list),
    or even (cons item1 (cons item2 some-list)).
Iterators can help (and in O(1)):

    >>> from itertools import chain
    >>> some_list = range(5)
    >>> item = 99
    >>> a = chain([item], some_list)
    >>> for x in a:
    ...     print x
    ...
    99
    0
    1
    2
    3
    4
Re:Functional programming in Python by gbog on Saturday May 12, 2012 @12:18AM (#3962737)
Yes. That's the hole point of the article, and matches very well with my understanding of SICP: functional programming is possible only if you model changing state in streams, which are just called iterators in python. All the fuss about python missing some parts too be really functional seem to have missed the point to me.