Browse files

Updated the `reduce` example... to actually show `reduce` instead of …

…`foldLeft` :-)
  • Loading branch information...
1 parent d0a49bc commit cc31ca200ace1e9907f742dbf5a100d2c2581567 @mhart mhart committed Jul 9, 2012
Showing with 1 addition and 7 deletions.
  1. +1 −7 README.md
View
8 README.md
@@ -1,4 +1,3 @@
-
packrattle
==========
@@ -144,12 +143,7 @@ for example, to match a sequence of numbers separated by "+" and add them:
this is aliased to "reduce" on Parser, with a simplified interface:
number = parser.regex(/\d+/).onMatch (m) -> parseInt(m[0])
- expr = parser.foldLeft(
- tail: number
- sep: parser.string("+")
- accumulator: (n) -> n
- fold: (sum, op, n) -> sum + n
- )
+ expr = number.reduce parser.string("+"), (sum, op, n) -> sum + n
implicit conversion
-------------------

0 comments on commit cc31ca2

Please sign in to comment.