Commit Graph

59 Commits

Author SHA1 Message Date
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
def
22b4e4c2f2 Use more Natural and Positive numbers in proc parameters
- Didn't go through all modules, only the main ones I thought of
- Building the compiler and tests still work
2015-04-06 02:24:17 +02:00
Araq
e80840c40a preparations for dealing with the 'echo $foo' gotcha 2015-03-27 02:14:27 +01:00
Hans Raaf
06ea53e692 Better documentation and rename of sortByIt(). 2015-03-11 22:22:58 +01:00
Araq
1efb5174f2 fixes #2220; #2219; breaks #2022; for #2022 callsite needs to be used 2015-03-10 12:32:46 +01:00
def
c3f6c7f8a3 Move sortByIt to algorithm module and add an example for it 2015-03-03 21:44:27 +01:00
def
28fa1c3b40 Add sorted proc to algorithm module 2015-02-20 04:57:53 +01:00
def
1ae4d535cd Add nextPermutation and prevPermutation
Fits best into algorithm module I guess. These are the most general
ways, an iterator could easily be implemented from this. Same algorithm
as in Rust: http://web.mit.edu/rust-lang_v0.11/doc/src/collections/var/tmp/alexp/rust/rust-0.11.0/src/libcollections/slice.rs.html#644
2015-02-01 18:29:01 +01:00
Araq
4523b29d7a Nimrod renamed to Nim 2014-08-28 09:59:26 +02:00
Araq
d05df2173b Nimrod renamed to Nim 2014-08-28 09:50:51 +02:00
Araq
27869b6c7b big rename 2014-08-28 00:36:14 +02:00
Araq
11b6958755 big rename 2014-08-27 23:42:51 +02:00
Araq
2f43fdb837 renamefest 2014-08-23 01:43:49 +02:00
def
8b796763a3 Fix to included last element in reversed 2014-07-09 18:54:05 +02:00
def
c591db16c8 Add reversed proc 2014-07-09 18:43:00 +02:00
Grzegorz Adam Hankiewicz
7da3c5e71e Adds do notation example to algorithm.sort. 2014-06-06 19:32:36 +02:00
Charlie Barto
76dfa611ed fixed doc comment 2014-03-27 15:13:10 -04:00
Charlie Barto
491291ae24 added usage example for lower bound 2014-03-27 00:21:19 -04:00
Charlie Barto
976fb18a8f made the default comparator for lowerBound unqualified, so the user can customize via two phase lookup 2014-03-23 18:30:54 -04:00
Charlie Barto
baa304f370 added lowerBound function to algorithm library 2014-03-23 18:28:05 -04:00
Simon Hafner
e01fb17d02 product more robust against empty input 2014-01-30 23:55:43 -06:00
Simon Hafner
f070edb8b9 forgot to export product 2014-01-30 02:09:37 -06:00
Simon Hafner
ac0f15379c added Cartesian product 2014-01-30 02:07:55 -06:00
Araq
92b8fac94a case consistency part 4 2013-12-27 23:10:36 +01:00
Grzegorz Adam Hankiewicz
72a3e21f28 Removes executable bit for text files. 2013-03-16 23:53:07 +01:00
Araq
a71c5f98ea made tests green again 2012-09-18 00:36:48 +02:00
Araq
8d99753d63 preparations for making 'closure' the default calling convention for proc types 2012-07-16 23:00:57 +02:00
Araq
32b4192b3f version 0.8.14 2012-02-09 01:18:33 +01:00
Araq
2633e3fb27 closure implementation: first steps 2012-02-04 15:47:48 +01:00