Konstantin Molchanov
fde4a086c5
8684 add shortcut sort procs ( #9174 )
...
* Stdlib: Algorithm: Add shortcut versions of sort, sorted, and isSorted procs.
* Add tests for sort, sorted, and isSorted procs from algorithm module.
* Merge sort tests into tsortcall.nim, remove tsort.nim.
* Stdlib: Algorithm: Add shortcut versions of sort, sorted, and isSorted procs.
* Add tests for sort, sorted, and isSorted procs from algorithm module.
* Merge sort tests into tsortcall.nim, remove tsort.nim.
2018-10-11 22:51:23 +02:00
Miran
47828efe32
better docs for algorithm module ( #9192 )
...
* better docs for `algorithm` module
* address the comments
* small first letter in the first sentence
* last argument is reverted to be `int`
* `rotateLeft` keeps `discardable` pragma, as discussed on IRC
* another small correction
2018-10-09 21:36:51 +02:00
Kaushal Modi
c0266e1afa
Fix typo in an algorithm runnableExamples ( #9260 )
...
Fixes the 'koch docs' build failure.
Ref:
b90b45b01b
2018-10-09 15:36:36 +02:00
pqflx3
b90b45b01b
Add algorithm.[sort,sorted,isSorted] overloads using 'system.cmp'. ( #8778 )
...
* Add algorithm.[sort,sorted,isSorted] overloads using 'system.cmp'. Fixes 8684.
* Change signatures to 'func'. Improve overload sort doc comments
2018-10-09 13:25:25 +02:00
Dmitry Atamanov
a075a912cf
Add algorithm.upperBound ( #7851 )
...
* Add algorithm.upperBound
* Docs updated
2018-05-29 07:28:15 +03:00
data-man
17b8bb8b47
Fixes binarySearch's bug
2018-05-23 12:58:26 +03:00
data-man
a093605ab0
binarySearch became even better
2018-05-23 12:40:55 +03:00
data-man
39a1ad650c
Faster binarySearch
2018-05-23 08:42:22 +03:00
Dmitry Atamanov
90afb1baa7
binarySearch improvements ( #7850 )
2018-05-20 20:11:25 +02:00
Araq
4b3ad4f00c
keep algorithm.nim warning free
2018-05-18 01:35:09 +02:00
Andreas Rumpf
272bbad784
Merge branch 'devel' into araq-parser-fixes
2018-05-06 08:03:29 +02:00
Araq
bbb0fd4eb7
remove deprecated stuff from the stdlib; introduce better deprecation warnings
2018-05-05 21:45:07 +02:00
Andreas Rumpf
1aa359febb
warn about inconsistent spacing around binary operators; fixes #7582
2018-05-05 14:58:33 +02:00
Arne Döring
6f4ca3f276
test binarySearch, fix for search in empty. ( #7769 )
2018-05-04 15:29:21 +02:00
Arne Döring
f94fafff9b
Deprecate smart binary search ( #7745 )
...
* deprecate smartBinarySearch
* changelog entry
2018-05-03 17:23:13 +02:00
Oscar Nihlgård
34df046d37
Fix algorithm.fill for empty input
2018-04-04 13:02:14 +02:00
Oscar Nihlgård
da077eea7c
Move algorithm tests away from koch
2018-04-04 13:00:51 +02:00
Yuriy Glukhov
5ea80b43b1
More flexible lowerBound interface ( #7344 )
2018-03-16 16:22:45 +01:00
Araq
e3b6ee85b3
algorithm.nim: change formatting to Nim's defaults
2018-03-05 13:20:50 +01:00
Andreas Rumpf
b14cc1e3b2
fixes #6631
2017-10-30 14:45:57 +01:00
Andreas Rumpf
a62051e304
updated algorithm.rotateLeft implementation
2017-10-30 08:42:44 +01:00
Arne Döring
484f729e27
use doAssert in rotateLeft example
2017-08-17 13:34:03 +02:00
Arne Döring
efe606ef81
fix for feedback on PR
2017-08-14 13:55:38 +02:00
Arne Döring
316886542b
allow a negative distance argument. Improved documentation.
2017-07-27 18:22:59 +02:00
Arne Döring
409854c913
changed rotate to rotateLeft with slice api
2017-07-27 17:40:33 +02:00
Arne Döring
c641751523
fixes for feedback
2017-07-27 17:40:33 +02:00
Arne Döring
c6c3ea5990
added rotate in algorithm
2017-07-27 17:40:33 +02:00
Andreas Rumpf
a88a909565
fixes #5625
2017-03-29 09:05:45 +02:00
fenekku
e9767d8809
Fix reverse on empty openArray ( #5407 )
...
Reversing an empty `openArray` would raise a RangeError. For instance for `a: seq[int] = @[]`, we have `a.high` return `-1` but `-1` is not a `Natural`. Leaving the array as-is is the expected behaviour.
2017-02-17 08:26:49 +01:00
Simon Ruderich
af2b0aed06
algorithm: sort: fix link in documentation
2016-09-15 04:20:24 +02:00
Ruslan Mustakov
91d3661522
Removed the use of .gensym pragma inside stdlib templates
2016-08-23 14:01:16 +07:00
Andreas Rumpf
8876ed23f1
expr and stmt are now deprecated
2016-07-30 16:34:42 +02:00
Reimer Behrends
4e222a1506
Fixed algorithm.reversed to work for empty seq's.
2015-08-14 15:14:56 +02:00
apense
bf58dd2141
Updated some example code in algorithm
2015-07-05 17:24:10 -04:00
takaomag
101e78df3b
Add tests for algorithm.reversed
2015-07-02 16:39:53 +00:00
takaomag
f529e14b04
Fix algorithm.reversed to accept non-zero 'first' arg
2015-07-02 14:32:13 +00:00
Araq
87f65f5e72
preparations for more Nimble packages; clear licensing; fixes #2949
2015-06-20 23:24:21 +02:00
apense
dc41beed5a
Added documentation
...
Now `isSorted` is documented.
2015-06-18 18:53:42 -04:00
apense
138cf777da
Removed redundant check
...
Loop takes care of it already
2015-06-18 14:43:38 -04:00
apense
3491047141
Fixed silly continue
...
The old if/else was weird and unnecessary
2015-06-17 20:14:53 -04:00
apense
ea1809a931
Added isSorted proc
...
Linear-time verification that an openarray is sorted. Operates on the same parameters as `sort`. Seems much cheaper for large sorts.
2015-06-17 19:56:32 -04:00
Andreas Rumpf
cb1f1cfd52
Merge pull request #2682 from koalazen/refactor_lowerbound_algorithm
...
shorten lowerBound in algorithm.nim
2015-06-07 10:53:12 +02:00
Andreas Rumpf
39c00d3dd1
Merge pull request #2733 from apense/patch-4
...
Small sequence fix for algorithm.nim
2015-05-25 00:49:48 +02:00
Koala Zen
7a2dce8012
refactored lowerBound in algorithm.nim
2015-05-18 14:59:05 -07:00
Dominik Picheta
61c7cc2ff7
Merge pull request #2701 from borisvassilev/fill
...
Fill array with same values (was issue #2462 )
2015-05-16 18:52:30 +01:00
apense
7b26df50d7
Small sequence fix for algorithm.nim
...
Since #853 was fixed, this should work fine. The `result = @[]` was swapped to the same syntax, too.
2015-05-15 23:52:55 -04:00
apense
e7bc828ef3
Update algorithm.nim
2015-05-14 18:32:26 -04:00
apense
78b7625417
Corrected sortedByIt example
...
`people` needs `var`
2015-05-14 14:16:58 -04:00
Boris Vassilev
3a3a7d012f
Fill array with same values (was issue #2462 )
2015-05-12 15:52:38 +03:00
Araq
caef835fe4
fixes #2568
2015-04-17 21:21:02 +02:00