diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2015-02-04 10:38:50 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2015-02-04 10:38:50 +0100 |
commit | f0cdb49c3bbd9ccd400d31c965ba270cef5682f5 (patch) | |
tree | 2053ab0d47636b635c91296ab6c6288c2071935f /lib | |
parent | a0d3bd16e73c98840c65ab890064e1aa750b7060 (diff) | |
parent | 07f42fa612db998ec88dade7ea3140ba6a15fb5b (diff) | |
download | Nim-f0cdb49c3bbd9ccd400d31c965ba270cef5682f5.tar.gz |
Merge pull request #2027 from dumndummer/patch-1
Update sequtils.nim
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/collections/sequtils.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/pure/collections/sequtils.nim b/lib/pure/collections/sequtils.nim index befc9bacb..b527b9368 100644 --- a/lib/pure/collections/sequtils.nim +++ b/lib/pure/collections/sequtils.nim @@ -382,7 +382,7 @@ template foldr*(sequence, operation: expr): expr = result = operation result -template mapIt*(seq1, typ, pred: expr): expr = +template mapIt*(seq1, typ, op: expr): expr = ## Convenience template around the ``map`` proc to reduce typing. ## ## The template injects the ``it`` variable which you can use directly in an @@ -397,10 +397,10 @@ template mapIt*(seq1, typ, pred: expr): expr = ## assert strings == @["4", "8", "12", "16"] var result {.gensym.}: seq[typ] = @[] for it {.inject.} in items(seq1): - result.add(pred) + result.add(op) result -template mapIt*(varSeq, pred: expr) = +template mapIt*(varSeq, op: expr) = ## Convenience template around the mutable ``map`` proc to reduce typing. ## ## The template injects the ``it`` variable which you can use directly in an @@ -413,7 +413,7 @@ template mapIt*(varSeq, pred: expr) = ## assert nums[0] + nums[3] == 15 for i in 0 .. <len(varSeq): let it {.inject.} = varSeq[i] - varSeq[i] = pred + varSeq[i] = op template newSeqWith*(len: int, init: expr): expr = ## creates a new sequence, calling `init` to initialize each value. Example: |