I'm a Japanese programmer. I write about C#, Ruby and JavaScript.
lambda{|a,b|10.times{p b=(a=a+b)-b}}.call(1,0)
Set of other codesPython :print reduce (lambda x,y:(x[1],x[0]+x[1],x[2]+[x[1]]), xrange(10), (0,1,[]))[2]Ruby:ruby -e ‘p,c=0,1;20.times{p p;c=p+p=c}’
Post a Comment
1 comment:
Set of other codes
Python :
print reduce (lambda x,y:(x[1],x[0]+x[1],x[2]+[x[1]]), xrange(10), (0,1,[]))[2]
Ruby:
ruby -e ‘p,c=0,1;20.times{p p;c=p+p=c}’
Post a Comment