inject's pathological case...

  • Thread starter Just Another Victim of the Ambient Morality
  • Start date
T

thufir

# example program to illustrate inject num_ary = [10,37,27,398,273,28]

# summing without inject:
without_inject_sum = 0
num_ary.each{|num| without_inject_sum += num}

# summing with inject
with_inject_sum = num_ary.inject{|sum, num| sum + num}



Thank you for the example. I'm not convinced that inject is fantastic,
but certainly it's something I need to understand and this example helps
to illuminates it.


-Thufir
 
T

thufir

B

Brian Adkins

I strongly disagree with that statement.

So 7stud, you learned Python and Ruby, decided you prefer Python, and
now hang out on the Ruby Talk mailing list bad mouthing our language?
What's the point, if you don't mind my asking?

The same as for any troll?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,289
Messages
2,571,435
Members
48,121
Latest member
ColinHibne

Latest Threads

Top