I want to add a non-destructive function shuffled.
Now, shuffle procedure is bang procedure.
But,please make shuffle procedure make nondestructive.
now, shuffle procedure's type is
proc shuffle*[T](x: var openArray[T]) =
please make shuffled procedure is
proc shuffled[T](x: seq[T]): seq[T] =
result = x
shuffle(result)
non-mutating version should be called shuffled.
openArray[T] is not a concrete type and as such cannot be returned. You can write something for seq, though, like this
proc shuffled[T](x: seq[T]): seq[T] =
result = x
shuffle(result)
[...] bang procedure.
We don't use that terminology here.
Regarding your suggestion to make a breaking change. We can't do that, because we don't make breaking changes.
I understood,thank you.
Is it possible to add shuffled?
Yes shuffled would be ok, but please edit your issue that you now want shuffled. Then I still can't guarantee that it will be implemented/merged, but I personally think it would be ok.
@krux02
Thank you.
I edit my issue.
Next I will make PR.
The request is solved by outplace.
I close this issue.
Most helpful comment
non-mutating version should be called
shuffled.