summary refs log tree commit diff stats
path: root/lib/pure/collections/sequtils.nim
Commit message (Collapse)AuthorAgeFilesLines
* sequtils: fix errors from `strictFuncs` use (#18998)ee72021-10-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Nim 1.4.x compiled the below code without error when using `--experimental:strictFuncs` import std/sequtils type Foo = ref object let foo1 = Foo() let foo2 = Foo() let foos = @[foo1, foo2] let fooTuples = @[(foo1, 1), (foo2, 2)] discard repeat(foo1, 3) discard zip(foos, foos) discard unzip(fooTuples) However, since 2020-12-09, devel Nim produced errors like /tmp/bar.nim(11, 15) template/generic instantiation of `repeat` from here /foo/nim/pure/collections/sequtils.nim(172, 6) Error: 'repeat' can have side effects an object reachable from 'x' is potentially mutated /foo/nim/pure/collections/sequtils.nim(183, 15) the mutation is here /foo/nim/pure/collections/sequtils.nim(183, 15) is the statement that connected the mutation to the parameter This commit reverts some `proc` to `func` changes so that code that: - calls `repeat`, `zip`, or `unzip` - and instantiates them with types containing `ref` can once again be compiled with `strictFuncs`. Otherwise, a user might be forced to drop or alter their `strictFuncs` use when upgrading from Nim 1.4.x, or when writing new code that uses these procedures (at least for now, with the current `strictFuncs` implementation). This commit also adds tests to assert that the remaining funcs in this module can be compiled with `strictFuncs` when used with types containing `ref`. The original batch of `proc` to `func` changes in `sequtils.nim` was in commit 6f57ebae349f, which was partially reverted in 38eb021f8158. See also: https://github.com/nim-lang/Nim/issues/16305
* sequtils now support strict effect tracking (#18782)Andreas Rumpf2021-09-021-9/+14
|
* deprecate `sequtils.delete` and add an overload with saner semantics ↵Timothee Cour2021-07-151-3/+42
| | | | | | | | consistent with `system.delete` (#18487) * deprecate sequtils.delete and add an overload with saner semantics * AssertionDefect => IndexDefect * improve tsequtils * add tests; use splice in js for optimization
* fix #7295: use move(result) inside template to avoid copy with --gc:refc ↵Timothee Cour2021-06-041-10/+10
| | | | (#18168)
* Change stdlib imports to use std prefix in most examples (#17202)Danil Yarantsev2021-02-281-2/+2
|
* remove outdated codes (#17140)flywind2021-02-221-1/+0
| | | | | * remove unnecessary when statement * remove outdated codes
* remove all uses of condsyms symbols defined prior to bootstrap nim 0.20.0 ↵Timothee Cour2021-02-171-19/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#16918) * nimNoArrayToCstringConversion deadcode * nimbabel deadcode * nimHasalignOf deadcode * nimvarargstyped deadcode * nimhygiene deadcode * nimNewTypedesc deadcode * nimlocks deadcode * nimHasCppDefine deadcode * nimHasRunnableExamples deadcode * nimHasNilChecks deadcode * nimSymKind deadcode * minor macros refactoring * nimVmEqIdent deadcode * nimNoNil deadcode * nimNoZeroTerminator deadcode * nimHasSymOwnerInMacro deadcode * nimVmExportFixed deadcode * nimNewRuntime deadcode * nimAshr deadcode * nimUncheckedArrayTyp deadcode * nimHasTypeof deadcode * nimErrorProcCanHaveBody deadcode * nimHasHotCodeReloading deadcode * nimHasSignatureHashInMacro deadcode * nimHasDefault deadcode * nimMacrosSizealignof deadcode
* Another typo corrected (#16974)Héctor M. Monacci2021-02-081-1/+1
| | | From `fliter proc` to `filter proc`
* Correct typo (#16972)Héctor M. Monacci2021-02-081-1/+1
| | | From `fliter proc` to `filter proc`
* Improve sequtils documentation (#16559)konsumlamm2021-01-041-78/+79
| | | | | | | * Improve sequtils documentation Uncomment assertions in tests * Use present tense
* sequtils.nim: Change some `func` back to `proc` (#16309)ee72020-12-141-28/+28
| | | | | | | | | | | This commit changes the funcs that take a `proc` parameter back to procs. This reverts some of commit 6f57ebae349f: sequtils.nim: Use `func` (#16293) See also: - https://github.com/nim-lang/Nim/issues/16303 - https://github.com/nim-lang/Nim/pull/16304
* clean the docs of sequtils (#16332)flywind2020-12-141-97/+89
|
* sequtils.nim: Use `func` (#16293)ee72020-12-091-46/+46
| | | | | | | | | * sequtils.nim: proc -> func * sequtils.nim: proc -> func in links * sequtils.nim: proc -> func in non-link doc comments * test: add `sequtils` to strictFuncs test
* fixed article duplication typos (#16216)ihlec2020-12-021-1/+1
|
* Grammar fixesClyybber2020-10-301-4/+4
|
* promote `collect` macro as a map+filter replacement (#15788)Miran2020-10-301-0/+27
| | | | | * promote `collect` macro as a map+filter replacement * Update lib/pure/collections/sequtils.nim
* Add 1 overload to apply (#15439)Juan Carlos2020-10-011-0/+5
|
* docs minor and #15335 (#15337)flywind2020-09-161-0/+7
|
* Fix #14994 (#14996)Clyybber2020-07-151-1/+2
| | | | | | | * Fix #14994 * Revert misplaced "optimization" * Typo
* remove isMainModule from json,os,sequtils (#14572)Timothee Cour2020-06-061-461/+0
| | | | | * move json.isMainModule => tjson * move isMainModule => tos,tsequtils
* fix #14404 foldr had the classic multiple evaluation bug (#14413)Timothee Cour2020-05-211-7/+7
|
* sequtils refactoring: prefer typeof over type (#14212)Andreas Rumpf2020-05-041-15/+15
|
* move since from inclrtl to std/private/since (#14188)hlaaftana2020-05-021-1/+1
| | | | * move since from inclrtl to std/private/since * move since import in system below for HCR
* fix mapIt issues #12625 & #12639 (#14041)Judd2020-04-211-14/+36
| | | | | | | | | | | | * fix mapIt issues #12625 & #12639: 1. fallback to call `map` when the result of `op` is a closure; 2. use `items(s)` in the for loop. * fix test errors. * add comments and InType is moved. * fix ident.
* return types must not be Natural for reasons I won't outline hereAraq2020-04-021-1/+1
|
* feature/count (#13837)Dean Eigenmann2020-04-021-0/+19
|
* revert stdlib changes which are not required anymoreAndreas Rumpf2020-04-011-2/+3
|
* Hrm, the new errors highlighted some code that seems to be brokenZahary Karadjov2020-04-011-3/+2
| | | | | | New issue: since `Table[A, B]` allocates its backing storage with `newSeq[KeyValuePair[A, B]]`, it's no longer legal to create a table with `not nil` types used as either keys or values.
* make unzip faster: seq[i]=val can be 7X faster than seq.add(elem) (#13448)Timothee Cour2020-02-211-5/+5
|
* Add `sequtils.unzip` to complement `sequtils.zip` (#13429)Kaushal Modi2020-02-201-0/+15
|
* Idxmin & idxmax, continuation (#13208)Miran2020-01-201-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add idxmin() which returns the index of the minimum value * Add idxmax() which returns the index of the maximum value * Add tests for idxmin() * Add tests for idxmax() * Remove initialization of result = 0 * Adds overloading for arrays (no enums indexed arrays yet) * Add support for enum index arrays * Fix tests with enum * Fix tests for idxmax * Change names of the procedures to minIndex and maxIndex * address Araq's comments: - remove 'array' versions - add .since pragma - return 'int' instead of 'Natural' - add changelog entry Co-authored-by: Federico A. Corazza <20555025+Imperator26@users.noreply.github.com>
* Fix sequtils.delete bug with out of bounds indexes (#12506)Oscar Nihlgård2019-11-291-1/+6
|
* remove long-deprecated 'mapIt'narimiran2019-11-131-7/+0
|
* Make sequtils.zip return seq of anonymous tuples (#12575)Kaushal Modi2019-11-041-40/+64
| | | | | | | | | | * Make sequtils.zip return seq of anonymous tuples Earlier the tuples had named fields "a" and "b" and that made it difficult to assign the zip returned seqs to other vars which expected seqs of tuples with field names other than "a" and "b". * Make sequtils.zip backwards compatible with Nim 1.0.x
* fix several typos in documentation and comments (#12553)Nindaleth2019-10-301-1/+1
|
* sequtils: replace deprecated 'random' call within example (#12515) [backport]Jjp1372019-10-251-1/+1
|
* Fix many broken linksJjp1372019-10-221-1/+1
| | | | | | Note that contrary to what docgen.rst currently says, the ids have to match exactly or else most web browsers will not jump to the intended symbol.
* use system.move instead of system.shallowCopy if the GC mode requires itAndreas Rumpf2019-10-041-4/+16
|
* Fix spellings (#12277) [backport]Federico Ceratto2019-09-271-2/+2
|
* styleCheck fix: type naming: s/outType/OutType/ (#11749)Kaushal Modi2019-07-161-9/+9
|
* [other] prettify collections (#11695)Miran2019-07-091-60/+63
|
* [bugfix] fix `delete` in strutils and sequtils (#11535)Miran2019-06-201-1/+1
|
* [other] documentation: deprecation comments are now auto-generatednarimiran2019-06-191-3/+1
|
* sequtils: minor typoAraq2019-05-101-1/+1
|
* reimplement_pr_10974 (#11130)cooldome2019-04-271-0/+16
|
* fixes #10433 (#10444)Miran2019-01-241-0/+9
|
* documentation: remove author field [ci skip]narimiran2019-01-171-2/+0
|
* sequtils doc: another quickfix [ci skip]narimiran2019-01-161-3/+3
|
* quickfix for sequtils docs [ci skip]narimiran2019-01-161-6/+3
|
* better docs: sequtilsnarimiran2019-01-161-303/+414
|