Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…`foldLeft` :-)
  • Loading branch information...
commit cc31ca200ace1e9907f742dbf5a100d2c2581567 1 parent d0a49bc
@mhart mhart authored
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
-------------------
Please sign in to comment.
Something went wrong with that request. Please try again.