mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-19 23:41:29 +00:00
@@ -846,6 +846,15 @@ template mapIt*(s: typed, op: untyped): untyped =
|
||||
result.add(op)
|
||||
result
|
||||
|
||||
template mapIt*(s, typ, op: untyped): untyped {.error:
|
||||
"Use 'mapIt(seq1, op)' - without specifying the type of the returned seqence".} =
|
||||
## **Deprecated since version 0.12.0:** Use the `mapIt(seq1, op) template
|
||||
## <#mapIt.t,typed,untyped>`_ instead.
|
||||
var result: seq[typ] = @[]
|
||||
for it {.inject.} in items(s):
|
||||
result.add(op)
|
||||
result
|
||||
|
||||
template applyIt*(varSeq, op: untyped) =
|
||||
## Convenience template around the mutable ``apply`` proc to reduce typing.
|
||||
##
|
||||
|
||||
Reference in New Issue
Block a user