Forum: Italian Ruby user group iccanobif

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
64aa4b69fdd7127e6f3ee16ae065a620?d=identicon&s=25 Giampiero Zanchi (giampiz)
on 2009-04-22 17:23
qualcosa di veramente inutile
la serie di Fibonacci tradizionalmente inizia con (1,1); però... provate
questo script

iccanobif = (1..10).inject(f = [1,1]) {|f, n| f.insert(-1,(f[-2] -
f[-1])) }
p "#{'fibonacci'.reverse}([1,1],10) = #{iccanobif.inspect}"

fibonacci = (1..10).inject(f = [1,1]) {|f, n| f.insert(-1,(f[-2] +
f[-1])) }
p "fibonacci([1,1],10) = #{fibonacci.inspect}"
seeds = [[1,1],[0,1],[1,0],[-1,1],[2,-1],[-3,2],[5,-3],[-8,5]]
(0...(seeds.size)).each do |i|
  seed = seeds[i].dup
  n = 10 + i
  fib = (1..n).inject(seed) {|f, n| f.insert(-1,(f[-2] + f[-1]))}
  p "fib(#{seeds[i].inspect},#{n}) = #{fib.inspect}"
end

scusate la divagazione, ma Ruby mi fa questo effetto
0e17cafb81abc6febf4779d0710c2611?d=identicon&s=25 luca sabato (Guest)
on 2009-04-22 19:09
(Received via mailing list)
?????????????????????????????????????????

diminuire le dosi di caffeina e nicotina aiutano a vivere
meglio :P :D :D :D :D

Il giorno 22/apr/09, alle ore 17:23, Giampiero Zanchi ha scritto:

>   n = 10 + i
>   fib = (1..n).inject(seed) {|f, n| f.insert(-1,(f[-2] + f[-1]))}
>   p "fib(#{seeds[i].inspect},#{n}) = #{fib.inspect}"
> end

luca sabato
---
nope --- the [nomad code]
email: ilramingo@gmail.com
pensieri: http://sabatia.it
D8fb06dfc08a477ecb0a76ffdbff3475?d=identicon&s=25 Chiaro Scuro (chiaroscuro)
on 2009-04-22 19:22
(Received via mailing list)
Ragazzo mio, sei veramente perverso :-)))
This topic is locked and can not be replied to.