[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Fwd: [Ruby Forum] Message from user iberci

James Gray

1/27/2008 4:00:00 PM

Begin forwarded message:

> From: coder68@yahoo.com
> Date: January 25, 2008 12:01:54 PM CST
> To: james@grayproductions.net
> Subject: [Ruby Forum] Message from user iberci
>
> iberci sent you the following message:
>
> ====================================
> First entry! Lurked since the beginning however and really appreciate
> the time and effort you put into them
>
> ilan
>
> ============== make_change.rb ============================
>
> #!/usr/bin/env ruby
>
> def make_change(amount, vals)
> vals.sort.reverse.map {|v| f = amount/v; amount %= v; Array.new(f){v}
> }.flatten
> end
>
> p make_change(ARGV[0].to_i, ARGV[1].split(',').map {|a| a.to_i})
> ====================================