Anonymous user
First-class functions/Use numbers analogously: Difference between revisions
First-class functions/Use numbers analogously (view source)
Revision as of 22:32, 13 October 2011
, 12 years ago→{{header|Ruby}}: Sync with First-class functions#Ruby. Both examples now use Proc#[]; this one had used Proc#call.
(→{{header|Ruby}}: Sync with First-class functions#Ruby. Both examples now use Proc#[]; this one had used Proc#call.) |
|||
Line 737:
<lang ruby>multiplier = proc {|n1, n2| proc {|m| n1 * n2 * m}}
numlist = [x=2, y=4, x+y]
p numlist.zip(
# => [0.5, 0.5, 0.5]</lang>
This structure is identical to the treatment of Ruby's [[First-
=={{header|Scala}}==
|