more descriptive names
This commit is contained in:
parent
a897693395
commit
ea752f29a0
1 changed files with 4 additions and 4 deletions
|
|
@ -43,8 +43,8 @@ proc concat*[T](seqs: varargs[seq[T]]): seq[T] =
|
||||||
result[i] = itm
|
result[i] = itm
|
||||||
inc(i)
|
inc(i)
|
||||||
|
|
||||||
proc count*[T](s: seq[T], x: T): int =
|
proc count*[T](list: seq[T], item: T): int =
|
||||||
## Count the occurrences of the item `x` in the sequence `s`.
|
## Count the occurrences of the item `item` in the sequence `list`.
|
||||||
##
|
##
|
||||||
## Example:
|
## Example:
|
||||||
##
|
##
|
||||||
|
|
@ -53,8 +53,8 @@ proc count*[T](s: seq[T], x: T): int =
|
||||||
## s = @[1, 2, 2, 3, 2, 4, 2]
|
## s = @[1, 2, 2, 3, 2, 4, 2]
|
||||||
## c = count(s, 2)
|
## c = count(s, 2)
|
||||||
## assert c == 4
|
## assert c == 4
|
||||||
for itm in items(s):
|
for x in items(list):
|
||||||
if itm == x:
|
if x == item:
|
||||||
inc result
|
inc result
|
||||||
|
|
||||||
proc cycle*[T](s: seq[T], n: Natural): seq[T] =
|
proc cycle*[T](s: seq[T], n: Natural): seq[T] =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue