Merge pull request #6992 from MartinNowak/merge_stable

Merge remote-tracking branch 'upstream/stable' into merge_stable
merged-on-behalf-of: Petar Kirov <ZombineDev@users.noreply.github.com>
This commit is contained in:
The Dlang Bot 2019-05-05 07:30:14 +02:00 committed by GitHub
commit e623fc11e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 57 deletions

View file

@ -1,6 +0,0 @@
Fixed comparison bug in `std.algorithm.comparison.levenshteinDistance`
Previously the algorithm was allocating the amount of memory which was equal to
the size of the biggest range, that is $(BIGOH max(s.length, t.length)).
This is now fixed to be $(BIGOH min(s.length, t.length)).
For more details see $(REF levenshteinDistance, std, algorithm, comparison).

View file

@ -1,43 +0,0 @@
`std.experimental.all` has been moved to `std`
`std.experimental.all` allowed the convenient use of all Phobos modules
with one import (`import std.experimental.all;`). With this release, this
convenience module has been stabilized and moved to `std`. From now on, the
convenience module can be accessed with `import std;`:
---
import std;
void main()
{
5f.iota.map!exp2.sum; // 31
}
---
Scripts and experimental code often use long and frequently changing
lists of imports from the standard library.
With this release it is possible to use `import std;` for importing the entire
standard library at once. This can be used for fast prototyping or REPLs:
---
import std;
void main()
{
6.iota
.filter!(a => a % 2) // 1 3 5
.map!(a => a * 2) // 2 6 10
.tee!writeln // peek into the processed stream
.substitute(6, -6) // 2 -6 10
.mean // (2 - 6 + 10) / 3
.reverseArgs!writefln("Sum: %.2f"); // 2
}
---
As before, symbol conflicts will only arise if a symbol with collisions is used.
In this case, $(LINK2 $(ROOT)spec/module.html#static_imports, static imports) or
$(LINK2 $(ROOT)spec/module.html#renamed_imports, renamed imports) can be used
to uniquely select a specific symbol.
The baseline cost for `import std;`
is less than half a second (varying from system to system) and
work is in progress to reduce this overhead even further.

View file

@ -124,10 +124,9 @@ template all(alias pred = "a")
{
static assert(is(typeof(unaryFun!pred(range.front))),
"`" ~ pred.stringof[1..$-1] ~ "` isn't a unary predicate function for range.front");
foreach (ref e; range)
if (!unaryFun!pred(e))
return false;
return true;
import std.functional : not;
return find!(not!(unaryFun!pred))(range).empty;
}
}
@ -154,6 +153,7 @@ are true.
{
int x = 1;
assert(all!(a => a > x)([2, 3]));
assert(all!"a == 0x00c9"("\xc3\x89")); // Test that `all` auto-decodes.
}
/++
@ -172,10 +172,7 @@ template any(alias pred = "a")
bool any(Range)(Range range)
if (isInputRange!Range && is(typeof(unaryFun!pred(range.front))))
{
foreach (ref e; range)
if (unaryFun!pred(e))
return true;
return false;
return !find!pred(range).empty;
}
}
@ -211,6 +208,7 @@ evaluate to true.
{
auto a = [ 1, 2, 0, 4 ];
assert(any!"a == 2"(a));
assert(any!"a == 0x3000"("\xe3\x80\x80")); // Test that `any` auto-decodes.
}
// balancedParens