monarchdodra
76f994abf9
Fix reduce regression 13304.
...
Also cover test case 10709.
2014-08-21 20:17:22 +02:00
IdanArye
0318f0ffba
fix issue 9942 - Add a functional switch function
...
std.algorithm.predSwitch is the functional version of the `switch`
statement(without a lookup table).
2014-08-09 17:13:15 +03:00
Dmitry Olshansky
53de1da98b
Merge pull request #2060 from monarchdodra/reduceReimpl
...
Re-implement reduce
2014-07-28 03:59:46 +04:00
monarchdodra
096ae6ab87
Use assertThrown
in reduce unittest
2014-07-27 22:59:07 +02:00
monarchdodra
2572cef9d4
Reduce unittest for 10709, 12569, and...
...
...an unfiled issue from the forums
2014-07-27 22:59:07 +02:00
monarch dodra
91d1864c2f
Re-implement reduce.
...
Consolidates the implementation, prepares for "fold", and also fixes a couple of issues:
http://forum.dlang.org/thread/oghtttkopzjshsuflelk@forum.dlang.org
https://issues.dlang.org/show_bug.cgi?id=10709
https://issues.dlang.org/show_bug.cgi?id=12569
2014-07-27 22:59:07 +02:00
monarchdodra
9d158ba52d
Fix Issue 8866 - Splitter(R1, R2) CANNOT be bidirectional.
2014-07-27 18:35:25 +02:00
Nils Boßung
4ebca8c2bd
change |=
to ||
2014-07-23 14:22:03 +02:00
Nils Boßung
a6da3ece06
fix Issue 13171 - std.algorithm.until(range, sentinel, OpenRight.no) doesn't propagate popping of sentinel to range
2014-07-20 23:39:49 +02:00
sinkuu
e989418fa5
Use unsigned-safe comparing in clamp contract
2014-07-19 08:10:25 +09:00
Dicebot
fe230e674f
Mention 'clamp' in the cheatsheet
2014-07-17 14:51:48 +02:00
Dicebot
8dc16d8109
Add in contract for clamp()
...
lower bound should not be larger than higher one
2014-07-17 14:47:34 +02:00
Dicebot
136e8661b6
Adjust clamp signature and tests
...
signed is now deduced over unsigned, added small documented unittest
instead of full block
2014-07-17 14:47:34 +02:00
Andreas Zwinkau
5cde6f5fd5
Add clamp function
...
Request in issue 10039
http://d.puremagic.com/issues/show_bug.cgi?id=10039
2014-07-17 14:47:34 +02:00
Dmitry Olshansky
1f4c14a067
Merge pull request #2195 from JamesDavidCarr/master
...
Changed distance() to be more memory efficient based on email from mailing list.
2014-07-17 00:40:57 +04:00
Михаил Страшун
04dee6bfe5
Merge pull request #2328 from quickfur/issue10693
...
Fix range violation for cartesianProduct of empty ranges.
2014-07-15 00:06:47 +03:00
H. S. Teoh
5f0155b0c8
.init value of cartesianProduct should be empty.
2014-07-14 12:47:28 -07:00
James Carr
0a7d2c9b10
Removed the accidental semicolon
2014-07-13 15:21:05 +01:00
James Carr
4beda7da9c
Changed the implementation of distance() so that it uses the memory inefficient version to prevent breakage in the API. Efficient version has been moved to distanceLowMem() in the struct and is called internally by levenshteinDistance()
2014-07-13 14:01:56 +01:00
James Carr
5102e9e273
Removed calls to matrix() in distance()
...
Since _matrix is now a single dimension matrix, calls to matrix() have
been removed and replaced with direct access equivalents.
2014-07-13 13:26:38 +01:00
James Carr
3e037f463e
Refactored distance() and corrected path()
...
Refactored distacen() so that it now accepts the lengths of the ranges
because we already calculate these in levenshteinDistance().
Altered ss in distance() and tt in distanceWithPath().
Moved popFront()’s to after their final usage to handle transitive
ranges.
Corrected path() so that it calls distanceWithPath() instead of
distance().
2014-07-13 13:26:38 +01:00
James Carr
0d0a2c0308
Refactored, added unit tests and removed opIndex.
...
Moved checks for which Range is longer to levenshteinDistance() method.
Reverted to implementation found in original distance() with regards to
using front/popFront instead of opIndex.
Fixed formatting of return statement.
Added two unit tests for levenshteinDistance().
Credit to @Poita.
2014-07-13 13:26:38 +01:00
James Carr
a9ae1023a2
Moved previous distance() implementation
...
Moved to be a private method and only expose new more memory efficient
distance(). This is done because we need the old implementation for
path(). Modified levenshteinDistanceAndPath() to use the old distance()
to reflect this.
2014-07-13 13:26:37 +01:00
James Carr
7f5aff5693
Fixed formatting
...
Moved all braces so that they are on their own lines and removed the trailing whitespace after function declaration;
2014-07-13 13:26:37 +01:00
James Carr
3a87433439
Modified Levenshtein distance()
...
Modified the implementation of Levenshtein distance so that it now uses O(n) memory but retains the same time complexity. However, does not work with path().
2014-07-13 13:26:37 +01:00
James Carr
4c9c85c183
Modified Levenshtein distance()
...
Modified the implementation of Levenshtein distance so that it now uses O(n) memory but retains the same time complexity. However, does not work with path().
2014-07-13 13:26:37 +01:00
Lionello Lunesu
2815d548d3
Added std.algorithm.safeLess for safe signed/unsigned comparison; rewrote min/max
2014-07-13 13:09:45 +08:00
H. S. Teoh
6e51fdf469
Fix range violation for cartesianProduct of empty ranges.
...
Completes the fix for: https://issues.dlang.org/show_bug.cgi?id=10693
2014-07-12 07:07:52 -07:00
Walter Bright
bcceb5424b
Merge pull request #2276 from quickfur/cprod_improve1
...
cartesianProduct improvement
2014-07-10 14:11:41 -07:00
safety0ff
b54f32eee6
std.algorithm.remove: Change pop____N to pop____Exactly
2014-07-02 19:57:44 -04:00
safety0ff
93068b15bd
std.algorithm.remove: Fix constraints and change popBack loop to popBackN
2014-07-02 19:57:44 -04:00
H. S. Teoh
95ea9c82ea
Get rid of exponential template bloat for most common use case of cartesianProduct.
2014-07-02 16:01:35 -07:00
H. S. Teoh
66287d0f29
Update unittest and example code to reflect new ordering.
2014-07-02 15:59:32 -07:00
H. S. Teoh
a8f80e04f2
cartesianProduct: default order should be lexicographically sorted.
2014-07-02 15:59:32 -07:00
David Nadlinger
733b895a8a
[trivial] Fix copy/paste error in minPos doc comment.
2014-06-28 09:09:00 +02:00
safety0ff
6ff3378c79
Add unittests bug #12889
2014-06-16 19:42:30 -04:00
Dmitry Olshansky
fdf5307d88
Merge pull request #2202 from monarchdodra/swapPointsTo
...
reinsert doesPointTo in swap/move
2014-05-31 06:55:46 -07:00
monarchdodra
b974846d2d
Re-insert doesPointTo in swap/move
2014-05-31 13:44:12 +02:00
Dmitry Olshansky
66fcbadf4d
Merge pull request #2053 from monarchdodra/maxTweak
...
Tweak min and max for yet more efficiency
2014-05-31 04:10:15 -07:00
Dmitry Olshansky
0ae323dc6f
Merge pull request #2167 from monarchdodra/pointsTo
...
Fix issues 9975 & 12479
2014-05-23 22:44:25 +04:00
Walter Bright
c6b3eb0a85
convert jagged array with rectangular one
2014-05-18 00:39:19 -07:00
monarch dodra
a4e448be50
Tweak min and max for yet more efficiency
...
I checked the generated assembly code, and it looks pretty damn good. I've not been able to achieve any better anyways.
2014-05-17 20:06:12 +02:00
monarchdodra
c885157507
Change pointsTo to mayPointTo and doesPointTo
2014-05-14 21:58:02 +02:00
monarch dodra
254290daf7
Merge pull request #2128 from AndrejMitrovic/Fix11253
...
Issue 11253 - std.algorithm.count is not nothrow
2014-05-09 22:08:25 +02:00
monarchdodra
d609bd332f
Sed "@safe pure nothrow"
2014-05-06 08:21:13 +02:00
Andrej Mitrovic
5ad48eb130
Fix Issue 11253 - std.algorithm.count is not nothrow.
2014-04-28 14:40:15 +02:00
Andrej Mitrovic
8c24b1e875
Fix Issue 12293 - Add forward to std.algorithm's cheat-sheet.
2014-04-27 01:00:06 +02:00
Andrej Mitrovic
e549dd037b
Strip spaces.
2014-04-26 21:13:39 +02:00
Andrej Mitrovic
6f05fc3f63
Merge pull request #2075 from monarchdodra/sumInfer
...
safe pure nothrow sort and sum
2014-04-26 01:08:47 +02:00
monarch dodra
79903eb199
Merge pull request #2107 from AndrejMitrovic/Fix7246
...
Issue 7246 - Provide a simpler example for std.algorithm.remove.
2014-04-23 19:56:37 +02:00