Skip to content

Commit

Permalink
* enum.c (enum_inject): updated documentation. a patch from Keita
Browse files Browse the repository at this point in the history
  Yamaguchi <[email protected]> in [ruby-dev:32686].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Dec 23, 2007
1 parent 19cf57f commit 9bfdc4e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Mon Dec 24 05:32:22 2007 Yukihiro Matsumoto <[email protected]>

* enum.c (enum_inject): updated documentation. a patch from Keita
Yamaguchi <[email protected]> in [ruby-dev:32686].

Mon Dec 24 05:13:04 2007 Yukihiro Matsumoto <[email protected]>

* string.c (tr_trans): should associate new encoding if modified.
Expand Down
6 changes: 3 additions & 3 deletions enum.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,12 @@ inject_op_i(VALUE i, VALUE p)

/*
* call-seq:
* enum.inject(sym, initial) => obj
* enum.inject(initial, sym) => obj
* enum.inject(sym) => obj
* enum.inject(initial) {| memo, obj | block } => obj
* enum.inject {| memo, obj | block } => obj
*
* enum.reduce(sym, initial) => obj
* enum.reduce(initial, sym) => obj
* enum.reduce(sym) => obj
* enum.reduce(initial) {| memo, obj | block } => obj
* enum.reduce {| memo, obj | block } => obj
Expand Down Expand Up @@ -403,7 +403,7 @@ inject_op_i(VALUE i, VALUE p)
* # Same using a block and inject
* (5..10).inject {|sum, n| sum + n } #=> 45
* # Multiply some numbers
* (5..10).reduce(:*, 1) #=> 151200
* (5..10).reduce(1, :*) #=> 151200
* # Same using a block
* (5..10).inject(1) {|product, n| product * n } #=> 151200
* # find the longest word
Expand Down

0 comments on commit 9bfdc4e

Please sign in to comment.