Skip to content

Commit

Permalink
fix for test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Judd committed Jan 21, 2025
1 parent a3b256d commit ad92b82
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/pure/collections/sequtils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func concat*[T](seqs: varargs[seq[T]]): seq[T] =
inc(i)

func addUnique*[T](s: var seq[T], x: sink T) =
## Adds `x` to the container `s` if it is not already present.
## Adds `x` to the container `s` if it is not already present.
## Uses `==` to check if the item is already present.
runnableExamples:
var a = @[1, 2, 3]
Expand Down Expand Up @@ -920,10 +920,11 @@ template foldl*(sequence, operation: untyped): untyped =
assert concatenation == "nimiscool"
assert foldl(procs, foo(a, b)) == "procIsAlsoFine"

assert sequence.len > 0, "Can't fold empty sequences"
let len = sequence.len
assert len > 0, "Can't fold empty sequences"
var result: typeof(sequence[0])
result = sequence[0]
for i in 1..<sequence.len:
for i in 1..<len:
let
a {.inject.} = result
b {.inject.} = sequence[i]
Expand Down

0 comments on commit ad92b82

Please sign in to comment.