Array#reduce is undefined
-------------------------

                 Key: JRUBY-3278
                 URL: http://jira.codehaus.org/browse/JRUBY-3278
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1.6
         Environment: jruby 1.1.6 (ruby 1.8.6 patchlevel 114) (2008-12-17 rev 
8388) [amd64-java]

            Reporter: Mikael Lammentausta
            Priority: Minor


Calculate the sum of all Array items:

Code (debug.rb):

arr = [34.0, 55.7, 84.6]
# method 1
total = 0.0; arr.each{|i| total += i}
puts total
# method 2
total = arr.reduce(:+)
puts total


Output:

 $ ruby debug.rb 
174.3
174.3

 $ jruby debug.rb 
174.3
debug.rb:6: undefined method `reduce' for [34.0, 55.7, 84.6]:Array 
(NoMethodError)



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to