On Saturday, November 22, 2014 10:40:23 AM UTC+5:30, Chris Angelico wrote: > On Sat, Nov 22, 2014 at 4:02 PM, Rustom Mody wrote: > > Thats not a single expression; which is possible with a lazy > > evaluation language like Haskell. > > Prelude> let ones = 1 : ones > > I'm not sure "lazy evaluation" is the key here, unless it also does > name lookups lazily. What happens if you do this: > > let foo = 1 : bar > let bar = 2 : 3 > foo > > Will that show 1, 2, 3? If so, then sure, lazy eval is what achieved > that - but it's also going to make it hard to track down name errors.
Prelude> let foo = 1 : bar; bar = 2 : [3] Prelude> foo [1,2,3] Prelude> let foo = 1 : bar; bar = 2 : foo Prelude> foo [1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1 <Control-C> -- https://mail.python.org/mailman/listinfo/python-list