Permalink
Browse files

Merge pull request #1 from mhart/patch-1

Updated the `reduce` example...
  • Loading branch information...
2 parents d0a49bc + cc31ca2 commit ef631fe6d62ccd4476a9fd8cda27ae6d21cb6781 @robey committed Jul 9, 2012
Showing with 1 addition and 7 deletions.
  1. +1 −7 README.md
View
@@ -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 ef631fe

Please sign in to comment.