Why doesn't std.algorithm.comparison.cmp support primitive types
such as
assert(cmp(0,1) == true);
?
On Saturday, May 02, 2015 01:21:14 Ali Çehreli via Digitalmars-d-learn wrote:
2) void foo(const(int[]) arr); // cannot affect anything
// (even capacity)
Actually, you can modify the capacity of arr quite easily. All you have to
do is slice it
On Friday, 1 May 2015 at 19:30:08 UTC, Ilya Yaroshenko wrote:
Both variants are wrong because uniq needs sorted ranges.
Probably you need something like that:
x = x.chain(y).sort.uniq.array;
Interesting.
Is
x = x.chain(y).sort
faster than
x ~= y;
x.sort;
?
If so why?
On Saturday, 2 May 2015 at 08:29:11 UTC, Per Nordlöw wrote:
Why doesn't std.algorithm.comparison.cmp support primitive
types such as
assert(cmp(0,1) == true);
?
Correction if mean
assert(cmp(0,1) == -1);
On Saturday, 2 May 2015 at 08:29:11 UTC, Per Nordlöw wrote:
Why doesn't std.algorithm.comparison.cmp support primitive
types such as
assert(cmp(0,1) == true);
?
I just found some forgotten code of my that solves it through
import std.range: only;
assert(cmp(only(0), only(1)) ==
On Saturday, 2 May 2015 at 10:18:07 UTC, Per Nordlöw wrote:
On Friday, 1 May 2015 at 19:30:08 UTC, Ilya Yaroshenko wrote:
Both variants are wrong because uniq needs sorted ranges.
Probably you need something like that:
x = x.chain(y).sort.uniq.array;
Interesting.
Is
x =
This is related to a discussion[1] that I had started recently but I
will give an even shorter example here:
void main()
{
// Two slices to all element
auto a = [ 1, 2, 3, 4 ];
auto b = a;
// Initially, they both have capacity (strange! :) )
assert(a.capacity == 7);
On Saturday, 2 May 2015 at 11:16:30 UTC, Meta wrote:
Probably the latter is slower than the former, at the very
least because the latter requires memory allocation whereas the
former does not.
Ahh!,
auto x = [11, 3, 2, 4, 5, 1];
auto y = [0, 3, 10, 2, 4, 5, 1];
auto z =
On Friday, 1 May 2015 at 20:04:58 UTC, Ilya Yaroshenko wrote:
This line can be removed:
.map!(ch = ch.idup)
On Friday, 1 May 2015 at 20:02:46 UTC, Ilya Yaroshenko wrote:
Current std.stdio is deprecated. This ad-hoc should works.
auto json = File(fileName)
On 05/02/2015 01:56 AM, Jonathan M Davis via Digitalmars-d-learn wrote:
I really don't think that it's reasonable in the general case to
expect to
be able to guarantee that the capacity of a dynamic array won't change.
Yes, it is very different from other languages like C and C++ that
On Saturday, 2 May 2015 at 13:08:27 UTC, Artur Skawina wrote:
On 05/02/15 05:28, Jens Bauer via Digitalmars-d-learn wrote:
On Saturday, 2 May 2015 at 03:21:38 UTC, Jens Bauer wrote:
For some reason, my build time has increased dramatically...
Building with 1 vector takes 0.6 seconds.
Building
It doesn't like it. Any thoughts ?
lexer.d(257): Error: safe function
'stdx.data.json.parser.JSONLexerRange!(MapResult!(__lambda3,
Result), cast(LexOptions)0, __lambda31).JSONLexerRange.empty'
cannot call system function
'app.lookupTickers.MapResult!(__lambda3, Result).MapResult.empty'
Have anybody cooked up any range adaptors for on the fly decoding
of bzipped files? Preferable compatible with phobos standard
interfaces for file io.
Should probably be built on top of
http://code.dlang.org/packages/bzip2
On 05/02/15 05:28, Jens Bauer via Digitalmars-d-learn wrote:
On Saturday, 2 May 2015 at 03:21:38 UTC, Jens Bauer wrote:
For some reason, my build time has increased dramatically...
Building with 1 vector takes 0.6 seconds.
Building with 2 vector takes 0.7 seconds.
Building with 4 vector
On Friday, 1 May 2015 at 18:37:41 UTC, Idan Arye wrote:
On Friday, 1 May 2015 at 17:45:02 UTC, bitwise wrote:
On Friday, 1 May 2015 at 02:35:52 UTC, Idan Arye wrote:
On Thursday, 30 April 2015 at 23:27:49 UTC, bitwise wrote:
Well, the third thing was just my reasoning for asking in
the first
On Saturday, 2 May 2015 at 02:51:52 UTC, Fyodor Ustinov wrote:
Simple code:
http://pastebin.com/raw.php?i=7jVeMFXQ
This code works compiled by DMD v2.066.1 and LDC2 (0.15.1)
based on DMD v2.066.1 and LLVM 3.5.0.
$ ./z
TUQLUE
42
11
Compiled by DMD v2.067.1 the program crashes:
$ ./aa
TUQLUE
On Saturday, May 02, 2015 07:46:27 Ali Çehreli via Digitalmars-d-learn wrote:
On 05/02/2015 01:56 AM, Jonathan M Davis via Digitalmars-d-learn wrote:
I really don't think that it's reasonable in the general case to
expect to
be able to guarantee that the capacity of a dynamic array won't
On Fri, 01 May 2015 14:37:40 -0400, Idan Arye generic...@gmail.com wrote:
Structs allow you to implement ref-counting smart pointers like you can
do in C++. There is an implementation in the standard library:
http://dlang.org/phobos/std_typecons.html#.RefCounted
Yeah, I guess I should have
On Saturday, 2 May 2015 at 13:50:10 UTC, Per Nordlöw wrote:
Have anybody cooked up any range adaptors for on the fly
decoding of bzipped files? Preferable compatible with phobos
standard interfaces for file io.
Should probably be built on top of
http://code.dlang.org/packages/bzip2
i use
On Saturday, 2 May 2015 at 19:38:01 UTC, Fyodor Ustinov wrote:
I see it by the lack of 42. :)
But why is this receive breaks down?
Report, please, about it (D)evepopers :)
https://issues.dlang.org/
You can use std.json or create TrustedInputRangeShell template
with @trasted methods:
struct TrustedInputRangeShell(Range)
{
Range* data;
auto front() @property @trusted { return (*data).front; }
//etc
}
But I am not sure about other parseJSONStream bugs.
This is probably trivial but I just can't make a break thru.
I've got C++ code using glm like so:
struct Vertex
{
glm::vec3 position;
glm::vec3 color;
}
Vertex triangle[] =
[
glm::vec3(0.0, 1.0, 0.0),
glm::vec3(1.0, 0.0, 0.0), // red
In std.process, the following declarations:
- final class Pid
- abstract final class environment
could be struct, couldn't they ?
Any particular reason behind this choice ?
On Saturday, 2 May 2015 at 22:01:10 UTC, WhatMeWorry wrote:
struct Vertex
{
vec3 position;
vec3 color;
}
Vertex triangle[6] =
[
vec3(0.0, 1.0, 0.0),
vec3(1.0, 0.0, 0.0), // red
// code removed for brevity.
];
I keep getting
We know that 'in' is equivalent to const scope:
http://dlang.org/function.html#parameters
So, the constness of 'in' is transitive as well, right?
Ali
On Saturday, 2 May 2015 at 19:13:45 UTC, Dennis Ritchie wrote:
On Saturday, 2 May 2015 at 02:51:52 UTC, Fyodor Ustinov wrote:
Simple code:
http://pastebin.com/raw.php?i=7jVeMFXQ
This code works compiled by DMD v2.066.1 and LDC2 (0.15.1)
based on DMD v2.066.1 and LLVM 3.5.0.
$ ./z
TUQLUE
42
On Friday, 1 May 2015 at 23:22:31 UTC, Dennis Ritchie wrote:
Maybe someone will show a primitive packed array. I really can
not imagine how to do it on D.
Maybe you can somehow use bitfields. While what happened is
something like this:
-
import std.stdio, std.bitmanip;
On Saturday, 2 May 2015 at 22:36:29 UTC, anonymous wrote:
On Saturday, 2 May 2015 at 22:01:10 UTC, WhatMeWorry wrote:
struct Vertex
{
vec3 position;
vec3 color;
}
Vertex triangle[6] =
[
vec3(0.0, 1.0, 0.0),
vec3(1.0, 0.0, 0.0), // red
//
28 matches
Mail list logo