@@ -110,12 +110,12 @@ macro evalOnceAs(expAlias, exp: untyped,
110110 newProc (name = genSym (nskTemplate, $ expAlias), params = [getType (untyped )],
111111 body = val, procType = nnkTemplateDef))
112112
113- proc concat * [T](seqs: varargs [seq [T]]): seq [T] =
113+ func concat * [T](seqs: varargs [seq [T]]): seq [T] =
114114 # # Takes several sequences' items and returns them inside a new sequence.
115115 # # All sequences must be of the same type.
116116 # #
117117 # # See also:
118- # # * `distribute proc <#distribute,seq[T],Positive>`_ for a reverse
118+ # # * `distribute func <#distribute,seq[T],Positive>`_ for a reverse
119119 # # operation
120120 # #
121121 runnableExamples:
@@ -135,7 +135,7 @@ proc concat*[T](seqs: varargs[seq[T]]): seq[T] =
135135 result [i] = itm
136136 inc (i)
137137
138- proc count * [T](s: openArray [T], x: T): int =
138+ func count * [T](s: openArray [T], x: T): int =
139139 # # Returns the number of occurrences of the item `x` in the container `s`.
140140 # #
141141 runnableExamples:
@@ -150,7 +150,7 @@ proc count*[T](s: openArray[T], x: T): int =
150150 if itm == x:
151151 inc result
152152
153- proc cycle * [T](s: openArray [T], n: Natural ): seq [T] =
153+ func cycle * [T](s: openArray [T], n: Natural ): seq [T] =
154154 # # Returns a new sequence with the items of the container `s` repeated
155155 # # `n` times.
156156 # # `n` must be a non-negative number (zero or more).
@@ -168,7 +168,7 @@ proc cycle*[T](s: openArray[T], n: Natural): seq[T] =
168168 result [o] = e
169169 inc o
170170
171- proc repeat * [T](x: T, n: Natural ): seq [T] =
171+ func repeat * [T](x: T, n: Natural ): seq [T] =
172172 # # Returns a new sequence with the item `x` repeated `n` times.
173173 # # `n` must be a non-negative number (zero or more).
174174 # #
@@ -181,7 +181,7 @@ proc repeat*[T](x: T, n: Natural): seq[T] =
181181 for i in 0 ..< n:
182182 result [i] = x
183183
184- proc deduplicate * [T](s: openArray [T], isSorted: bool = false ): seq [T] =
184+ func deduplicate * [T](s: openArray [T], isSorted: bool = false ): seq [T] =
185185 # # Returns a new sequence without duplicates.
186186 # #
187187 # # Setting the optional argument ``isSorted`` to ``true`` (default: false)
@@ -209,7 +209,7 @@ proc deduplicate*[T](s: openArray[T], isSorted: bool = false): seq[T] =
209209 for itm in items (s):
210210 if not result .contains (itm): result .add (itm)
211211
212- proc minIndex * [T](s: openArray [T]): int {.since : (1 , 1 ).} =
212+ func minIndex * [T](s: openArray [T]): int {.since : (1 , 1 ).} =
213213 # # Returns the index of the minimum value of `s`.
214214 # # ``T`` needs to have a ``<`` operator.
215215 runnableExamples:
@@ -226,7 +226,7 @@ proc minIndex*[T](s: openArray[T]): int {.since: (1, 1).} =
226226 for i in 1 .. high (s):
227227 if s[i] < s[result ]: result = i
228228
229- proc maxIndex * [T](s: openArray [T]): int {.since : (1 , 1 ).} =
229+ func maxIndex * [T](s: openArray [T]): int {.since : (1 , 1 ).} =
230230 # # Returns the index of the maximum value of `s`.
231231 # # ``T`` needs to have a ``<`` operator.
232232 runnableExamples:
@@ -245,7 +245,7 @@ proc maxIndex*[T](s: openArray[T]): int {.since: (1, 1).} =
245245
246246
247247template zipImpl (s1, s2, retType: untyped ): untyped =
248- proc zip * [S, T](s1: openArray [S], s2: openArray [T]): retType =
248+ func zip * [S, T](s1: openArray [S], s2: openArray [T]): retType =
249249 # # Returns a new sequence with a combination of the two input containers.
250250 # #
251251 # # The input containers can be of different types.
@@ -288,7 +288,7 @@ when (NimMajor, NimMinor) <= (1, 0):
288288else :
289289 zipImpl (s1, s2, seq [(S, T)])
290290
291- proc unzip * [S, T](s: openArray [(S, T)]): (seq [S], seq [T]) {.since : (1 , 1 ).} =
291+ func unzip * [S, T](s: openArray [(S, T)]): (seq [S], seq [T]) {.since : (1 , 1 ).} =
292292 # # Returns a tuple of two sequences split out from a sequence of 2-field tuples.
293293 runnableExamples:
294294 let
@@ -303,19 +303,19 @@ proc unzip*[S, T](s: openArray[(S, T)]): (seq[S], seq[T]) {.since: (1, 1).} =
303303 result [0 ][i] = s[i][0 ]
304304 result [1 ][i] = s[i][1 ]
305305
306- proc distribute * [T](s: seq [T], num: Positive , spread = true ): seq [seq [T]] =
306+ func distribute * [T](s: seq [T], num: Positive , spread = true ): seq [seq [T]] =
307307 # # Splits and distributes a sequence `s` into `num` sub-sequences.
308308 # #
309309 # # Returns a sequence of `num` sequences. For *some* input values this is the
310- # # inverse of the `concat <#concat,varargs[seq[T]]>`_ proc .
310+ # # inverse of the `concat <#concat,varargs[seq[T]]>`_ func .
311311 # # The input sequence `s` can be empty, which will produce
312312 # # `num` empty sequences.
313313 # #
314314 # # If `spread` is false and the length of `s` is not a multiple of `num`, the
315- # # proc will max out the first sub-sequence with ``1 + len(s) div num``
315+ # # func will max out the first sub-sequence with ``1 + len(s) div num``
316316 # # entries, leaving the remainder of elements to the last sequence.
317317 # #
318- # # On the other hand, if `spread` is true, the proc will distribute evenly
318+ # # On the other hand, if `spread` is true, the func will distribute evenly
319319 # # the remainder of the division across all sequences, which makes the result
320320 # # more suited to multithreading where you are passing equal sized work units
321321 # # to a thread pool and want to maximize core usage.
@@ -360,7 +360,7 @@ proc distribute*[T](s: seq[T], num: Positive, spread = true): seq[seq[T]] =
360360 result [i].add (s[g])
361361 first = last
362362
363- proc map * [T, S](s: openArray [T], op: proc (x: T): S {.closure .}):
363+ func map * [T, S](s: openArray [T], op: proc (x: T): S {.closure .}):
364364 seq [S]{.inline .} =
365365 # # Returns a new sequence with the results of `op` proc applied to every
366366 # # item in the container `s`.
@@ -374,7 +374,7 @@ proc map*[T, S](s: openArray[T], op: proc (x: T): S {.closure.}):
374374 # # See also:
375375 # # * `sugar.collect macro<sugar.html#collect.m%2Cuntyped%2Cuntyped>`_
376376 # # * `mapIt template<#mapIt.t,typed,untyped>`_
377- # # * `apply proc <#apply,openArray[T],proc(T)_2>`_ for the in-place version
377+ # # * `apply func <#apply,openArray[T],proc(T)_2>`_ for the in-place version
378378 # #
379379 runnableExamples:
380380 let
@@ -386,7 +386,7 @@ proc map*[T, S](s: openArray[T], op: proc (x: T): S {.closure.}):
386386 for i in 0 ..< s.len:
387387 result [i] = op (s[i])
388388
389- proc apply * [T](s: var openArray [T], op: proc (x: var T) {.closure .})
389+ func apply * [T](s: var openArray [T], op: proc (x: var T) {.closure .})
390390 {.inline .} =
391391 # # Applies `op` to every item in `s` modifying it directly.
392392 # #
@@ -397,7 +397,7 @@ proc apply*[T](s: var openArray[T], op: proc (x: var T) {.closure.})
397397 # #
398398 # # See also:
399399 # # * `applyIt template<#applyIt.t,untyped,untyped>`_
400- # # * `map proc <#map,openArray[T],proc(T)>`_
400+ # # * `map func <#map,openArray[T],proc(T)>`_
401401 # #
402402 runnableExamples:
403403 var a = @ [" 1" , " 2" , " 3" , " 4" ]
@@ -406,7 +406,7 @@ proc apply*[T](s: var openArray[T], op: proc (x: var T) {.closure.})
406406
407407 for i in 0 ..< s.len: op (s[i])
408408
409- proc apply * [T](s: var openArray [T], op: proc (x: T): T {.closure .})
409+ func apply * [T](s: var openArray [T], op: proc (x: T): T {.closure .})
410410 {.inline .} =
411411 # # Applies `op` to every item in `s` modifying it directly.
412412 # #
@@ -417,7 +417,7 @@ proc apply*[T](s: var openArray[T], op: proc (x: T): T {.closure.})
417417 # #
418418 # # See also:
419419 # # * `applyIt template<#applyIt.t,untyped,untyped>`_
420- # # * `map proc <#map,openArray[T],proc(T)>`_
420+ # # * `map func <#map,openArray[T],proc(T)>`_
421421 # #
422422 runnableExamples:
423423 var a = @ [" 1" , " 2" , " 3" , " 4" ]
@@ -426,7 +426,7 @@ proc apply*[T](s: var openArray[T], op: proc (x: T): T {.closure.})
426426
427427 for i in 0 ..< s.len: s[i] = op (s[i])
428428
429- proc apply * [T](s: openArray [T], op: proc (x: T) {.closure .}) {.inline , since : (1 , 3 ).} =
429+ func apply * [T](s: openArray [T], op: proc (x: T) {.closure .}) {.inline , since : (1 , 3 ).} =
430430 # # Same as `apply` but for proc that do not return and do not mutate `s` directly.
431431 runnableExamples: apply ([0 , 1 , 2 , 3 , 4 ], proc (item: int ) = echo item)
432432 for i in 0 ..< s.len: op (s[i])
@@ -440,7 +440,7 @@ iterator filter*[T](s: openArray[T], pred: proc(x: T): bool {.closure.}): T =
440440 # #
441441 # # See also:
442442 # # * `sugar.collect macro<sugar.html#collect.m%2Cuntyped%2Cuntyped>`_
443- # # * `fliter proc <#filter,openArray[T],proc(T)>`_
443+ # # * `fliter func <#filter,openArray[T],proc(T)>`_
444444 # # * `filterIt template<#filterIt.t,untyped,untyped>`_
445445 # #
446446 runnableExamples:
@@ -454,7 +454,7 @@ iterator filter*[T](s: openArray[T], pred: proc(x: T): bool {.closure.}): T =
454454 if pred (s[i]):
455455 yield s[i]
456456
457- proc filter * [T](s: openArray [T], pred: proc (x: T): bool {.closure .}): seq [T]
457+ func filter * [T](s: openArray [T], pred: proc (x: T): bool {.closure .}): seq [T]
458458 {.inline .} =
459459 # # Returns a new sequence with all the items of `s` that fulfilled the
460460 # # predicate `pred` (function that returns a `bool`).
@@ -466,7 +466,7 @@ proc filter*[T](s: openArray[T], pred: proc(x: T): bool {.closure.}): seq[T]
466466 # # * `sugar.collect macro<sugar.html#collect.m%2Cuntyped%2Cuntyped>`_
467467 # # * `filterIt template<#filterIt.t,untyped,untyped>`_
468468 # # * `filter iterator<#filter.i,openArray[T],proc(T)>`_
469- # # * `keepIf proc <#keepIf,seq[T],proc(T)>`_ for the in-place version
469+ # # * `keepIf func <#keepIf,seq[T],proc(T)>`_ for the in-place version
470470 # #
471471 runnableExamples:
472472 let
@@ -481,19 +481,19 @@ proc filter*[T](s: openArray[T], pred: proc(x: T): bool {.closure.}): seq[T]
481481 if pred (s[i]):
482482 result .add (s[i])
483483
484- proc keepIf * [T](s: var seq [T], pred: proc (x: T): bool {.closure .})
484+ func keepIf * [T](s: var seq [T], pred: proc (x: T): bool {.closure .})
485485 {.inline .} =
486486 # # Keeps the items in the passed sequence `s` if they fulfilled the
487487 # # predicate `pred` (function that returns a `bool`).
488488 # #
489489 # # Note that `s` must be declared as a ``var``.
490490 # #
491- # # Similar to the `filter proc <#filter,openArray[T],proc(T)>`_,
491+ # # Similar to the `filter func <#filter,openArray[T],proc(T)>`_,
492492 # # but modifies the sequence directly.
493493 # #
494494 # # See also:
495495 # # * `keepItIf template<#keepItIf.t,seq,untyped>`_
496- # # * `filter proc <#filter,openArray[T],proc(T)>`_
496+ # # * `filter func <#filter,openArray[T],proc(T)>`_
497497 # #
498498 runnableExamples:
499499 var floats = @ [13.0 , 12.5 , 5.8 , 2.0 , 6.1 , 9.9 , 10.1 ]
@@ -511,7 +511,7 @@ proc keepIf*[T](s: var seq[T], pred: proc(x: T): bool {.closure.})
511511 inc (pos)
512512 setLen (s, pos)
513513
514- proc delete * [T](s: var seq [T]; first, last: Natural ) =
514+ func delete * [T](s: var seq [T]; first, last: Natural ) =
515515 # # Deletes in the items of a sequence `s` at positions ``first..last``
516516 # # (including both ends of a range).
517517 # # This modifies `s` itself, it does not return a copy.
@@ -536,7 +536,7 @@ proc delete*[T](s: var seq[T]; first, last: Natural) =
536536 inc (j)
537537 setLen (s, newLen)
538538
539- proc insert * [T](dest: var seq [T], src: openArray [T], pos = 0 ) =
539+ func insert * [T](dest: var seq [T], src: openArray [T], pos = 0 ) =
540540 # # Inserts items from `src` into `dest` at position `pos`. This modifies
541541 # # `dest` itself, it does not return a copy.
542542 # #
@@ -574,7 +574,7 @@ template filterIt*(s, pred: untyped): untyped =
574574 # # Returns a new sequence with all the items of `s` that fulfilled the
575575 # # predicate `pred`.
576576 # #
577- # # Unlike the `filter proc <#filter,openArray[T],proc(T)>`_ and
577+ # # Unlike the `filter func <#filter,openArray[T],proc(T)>`_ and
578578 # # `filter iterator<#filter.i,openArray[T],proc(T)>`_,
579579 # # the predicate needs to be an expression using the ``it`` variable
580580 # # for testing, like: ``filterIt("abcxyz", it == 'x')``.
@@ -584,7 +584,7 @@ template filterIt*(s, pred: untyped): untyped =
584584 # #
585585 # # See also:
586586 # # * `sugar.collect macro<sugar.html#collect.m%2Cuntyped%2Cuntyped>`_
587- # # * `fliter proc <#filter,openArray[T],proc(T)>`_
587+ # # * `fliter func <#filter,openArray[T],proc(T)>`_
588588 # # * `filter iterator<#filter.i,openArray[T],proc(T)>`_
589589 # #
590590 runnableExamples:
@@ -604,12 +604,12 @@ template keepItIf*(varSeq: seq, pred: untyped) =
604604 # # Keeps the items in the passed sequence (must be declared as a ``var``)
605605 # # if they fulfilled the predicate.
606606 # #
607- # # Unlike the `keepIf proc <#keepIf,seq[T],proc(T)>`_,
607+ # # Unlike the `keepIf func <#keepIf,seq[T],proc(T)>`_,
608608 # # the predicate needs to be an expression using
609609 # # the ``it`` variable for testing, like: ``keepItIf("abcxyz", it == 'x')``.
610610 # #
611611 # # See also:
612- # # * `keepIf proc <#keepIf,seq[T],proc(T)>`_
612+ # # * `keepIf func <#keepIf,seq[T],proc(T)>`_
613613 # # * `filterIt template<#filterIt.t,untyped,untyped>`_
614614 # #
615615 runnableExamples:
@@ -648,13 +648,13 @@ since (1, 1):
648648 if pred: result += 1
649649 result
650650
651- proc all * [T](s: openArray [T], pred: proc (x: T): bool {.closure .}): bool =
651+ func all * [T](s: openArray [T], pred: proc (x: T): bool {.closure .}): bool =
652652 # # Iterates through a container and checks if every item fulfills the
653653 # # predicate.
654654 # #
655655 # # See also:
656656 # # * `allIt template<#allIt.t,untyped,untyped>`_
657- # # * `any proc <#any,openArray[T],proc(T)>`_
657+ # # * `any func <#any,openArray[T],proc(T)>`_
658658 # #
659659 runnableExamples:
660660 let numbers = @ [1 , 4 , 5 , 8 , 9 , 7 , 4 ]
@@ -670,12 +670,12 @@ template allIt*(s, pred: untyped): bool =
670670 # # Iterates through a container and checks if every item fulfills the
671671 # # predicate.
672672 # #
673- # # Unlike the `all proc <#all,openArray[T],proc(T)>`_,
673+ # # Unlike the `all func <#all,openArray[T],proc(T)>`_,
674674 # # the predicate needs to be an expression using
675675 # # the ``it`` variable for testing, like: ``allIt("abba", it == 'a')``.
676676 # #
677677 # # See also:
678- # # * `all proc <#all,openArray[T],proc(T)>`_
678+ # # * `all func <#all,openArray[T],proc(T)>`_
679679 # # * `anyIt template<#anyIt.t,untyped,untyped>`_
680680 # #
681681 runnableExamples:
@@ -690,13 +690,13 @@ template allIt*(s, pred: untyped): bool =
690690 break
691691 result
692692
693- proc any * [T](s: openArray [T], pred: proc (x: T): bool {.closure .}): bool =
693+ func any * [T](s: openArray [T], pred: proc (x: T): bool {.closure .}): bool =
694694 # # Iterates through a container and checks if some item fulfills the
695695 # # predicate.
696696 # #
697697 # # See also:
698698 # # * `anyIt template<#anyIt.t,untyped,untyped>`_
699- # # * `all proc <#all,openArray[T],proc(T)>`_
699+ # # * `all func <#all,openArray[T],proc(T)>`_
700700 # #
701701 runnableExamples:
702702 let numbers = @ [1 , 4 , 5 , 8 , 9 , 7 , 4 ]
@@ -712,12 +712,12 @@ template anyIt*(s, pred: untyped): bool =
712712 # # Iterates through a container and checks if some item fulfills the
713713 # # predicate.
714714 # #
715- # # Unlike the `any proc <#any,openArray[T],proc(T)>`_,
715+ # # Unlike the `any func <#any,openArray[T],proc(T)>`_,
716716 # # the predicate needs to be an expression using
717717 # # the ``it`` variable for testing, like: ``anyIt("abba", it == 'a')``.
718718 # #
719719 # # See also:
720- # # * `any proc <#any,openArray[T],proc(T)>`_
720+ # # * `any func <#any,openArray[T],proc(T)>`_
721721 # # * `allIt template<#allIt.t,untyped,untyped>`_
722722 # #
723723 runnableExamples:
@@ -840,7 +840,7 @@ template foldl*(sequence, operation: untyped): untyped =
840840 procs = @ [" proc" , " Is" , " Also" , " Fine" ]
841841
842842
843- proc foo (acc, cur: string ): string =
843+ func foo (acc, cur: string ): string =
844844 result = acc & cur
845845
846846 assert addition == 25 , " Addition is (((5)+9)+11)"
@@ -944,7 +944,7 @@ template mapIt*(s: typed, op: untyped): untyped =
944944 # #
945945 # # See also:
946946 # # * `sugar.collect macro<sugar.html#collect.m%2Cuntyped%2Cuntyped>`_
947- # # * `map proc <#map,openArray[T],proc(T)>`_
947+ # # * `map func <#map,openArray[T],proc(T)>`_
948948 # # * `applyIt template<#applyIt.t,untyped,untyped>`_ for the in-place version
949949 # #
950950 runnableExamples:
@@ -1005,14 +1005,14 @@ template mapIt*(s: typed, op: untyped): untyped =
10051005 map (s, f)
10061006
10071007template applyIt * (varSeq, op: untyped ) =
1008- # # Convenience template around the mutable ``apply`` proc to reduce typing.
1008+ # # Convenience template around the mutable ``apply`` func to reduce typing.
10091009 # #
10101010 # # The template injects the ``it`` variable which you can use directly in an
10111011 # # expression. The expression has to return the same type as the sequence you
10121012 # # are mutating.
10131013 # #
10141014 # # See also:
1015- # # * `apply proc <#apply,openArray[T],proc(T)_2>`_
1015+ # # * `apply func <#apply,openArray[T],proc(T)_2>`_
10161016 # # * `mapIt template<#mapIt.t,typed,untyped>`_
10171017 # #
10181018 runnableExamples:
@@ -1048,7 +1048,7 @@ template newSeqWith*(len: int, init: untyped): untyped =
10481048 result [i] = init
10491049 result
10501050
1051- proc mapLitsImpl (constructor: NimNode ; op: NimNode ; nested: bool ;
1051+ func mapLitsImpl (constructor: NimNode ; op: NimNode ; nested: bool ;
10521052 filter = nnkLiterals): NimNode =
10531053 if constructor.kind in filter:
10541054 result = newNimNode (nnkCall, lineInfoFrom = constructor)
0 commit comments