On 05/01/2015 06:39 PM, "Per =?UTF-8?B?Tm9yZGzDtnci?=
" wrote:> On Friday, 1 May 2015 at 22:47:17 UTC,
Ali Çehreli wrote:
>> It is about the uniqueness of consecutive elements. It says "unique
>> consecutive elements".
>>
>> Ali
>
> Ah.
>
> Then I guess that if input is SortedRange then SortedRa
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 takes 0.9 seconds.
Building with 8 vector takes 1.1 seconds.
Building
On 04/27/15 19:49, Jens Bauer via Digitalmars-d-learn wrote:
I was wondering if there's a way to reduce my bulky startup
files a bit.
On Wednesday, 29 April 2015 at 13:58:14 UTC, Artur Skawina wrote:
mixin(VectorFuncs!(q{
PTR stack = {`_stack`};
EXC Reset_Handler = {`defaultRes
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
Segmentation fault
What I'm doing wrong?
ERRATA CORRIGE:
in place of x_s replace with x_n.
Sorry
On Friday, 1 May 2015 at 11:03:19 UTC, anonymous wrote:
If x_n is a constant (enum), you can use that to create a
function instead of a delegate:
void main() {
enum real x_n = 1;
real x_m = -1;
real function(real) s_n = z => F1(z, x_n);
auto J = jac(s_n, x_m);
}
If x_
On Friday, 1 May 2015 at 22:47:17 UTC, Ali Çehreli wrote:
It is about the uniqueness of consecutive elements. It says
"unique consecutive elements".
Ali
Ah.
Then I guess that if input is SortedRange then SortedRange should
be returned.
Thanks.
On Friday, 1 May 2015 at 21:36:29 UTC, Artur Skawina wrote:
On 05/01/15 22:29, Jens Bauer via Digitalmars-d-learn wrote:
On Wednesday, 29 April 2015 at 13:58:14 UTC, Artur Skawina
wrote:
Use `@weakalias!"blah"` instead:
enum weakalias(string A) = gcc.attribute.attribute("alias",
A);
@
Maybe someone will show a primitive packed array. I really can
not imagine how to do it on D.
On Friday, 1 May 2015 at 11:15:01 UTC, Laeeth Isharc wrote:
http://radar.oreilly.com/2015/04/investigating-sparks-performance.html
paper:
http://www.eecs.berkeley.edu/~keo/publications/nsdi15-final147.pdf
On 05/01/2015 03:41 PM, "Per =?UTF-8?B?Tm9yZGzDtnci?=
" wrote:
> so why doesn't
>
> http://dlang.org/phobos/std_algorithm_iteration.html#.uniq
>
> say anything about need for sortness!?
It is about the uniqueness of consecutive elements. It says "unique
consecutive elements".
Ali
On Friday, 1 May 2015 at 19:30:08 UTC, Ilya Yaroshenko wrote:
Probably you need something like that:
x = x.chain(y).sort.uniq.array;
You're right:
import std.stdio, std.algorithm, std.range;
auto x = [11, 3, 2, 4, 5, 1];
auto y = [0, 3, 10, 2, 4, 5, 1];
writeln(x.chain(y).uniq
On Friday, 1 May 2015 at 21:50:51 UTC, anonymous wrote:
What's that supposed to do?
Excuse me, what is not said. I thought that my wish will be
obvious.
On Friday, 1 May 2015 at 21:59:31 UTC, Ali Çehreli wrote:
On 05/01/2015 02:41 PM, Dennis Ritchie wrote:
> immutable string[] s = [ "
fix:
completeSort(x.assumeSorted, y);
x = x.chain(y).uniq.array;
or (was fixed)
y = y.sort().uniq.array;
completeSort(x.assumeSorted, y);
x ~= y;
On 05/01/2015 02:41 PM, Dennis Ritchie wrote:
> immutable string[] s = [ "foo", "bar" ];
>
> writeln(mixin(`format("%(%s, %)", s)`));;
If you are trying to call those functions, remove the double quotes by
%-(, and use %| to specify what is a delimiter. To call, each needs a
semicolo
On Friday, 1 May 2015 at 21:41:10 UTC, Dennis Ritchie wrote:
My final goal is to do something like this:
-
import std.stdio, std.string;
int foo() {
return 5;
}
int bar() {
return 10;
}
void main()
{
immutable string[] s = [ "foo", "bar" ];
writeln(mixin(`
On Friday, 1 May 2015 at 21:26:20 UTC, anonymous wrote:
On Friday, 1 May 2015 at 21:04:10 UTC, Dennis Ritchie wrote:
hi,
Is it possible to call functions using mixins in this way?
-
import std.stdio;
int fooTestMixin() {
return 5;
}
void main() {
enum t { fooTestMixin };
On 05/01/15 22:29, Jens Bauer via Digitalmars-d-learn wrote:
> On Wednesday, 29 April 2015 at 13:58:14 UTC, Artur Skawina wrote:
>> On 04/27/15 19:49, Jens Bauer via Digitalmars-d-learn wrote:
>>> I was wondering if there's a way to reduce my bulky startup files a bit.
> {snip}
>
>> Just create a
On Friday, 1 May 2015 at 21:04:10 UTC, Dennis Ritchie wrote:
hi,
Is it possible to call functions using mixins in this way?
-
import std.stdio;
int fooTestMixin() {
return 5;
}
void main() {
enum t { fooTestMixin };
immutable string[] strArr = [ "fooTestMixin" ];
hi,
Is it possible to call functions using mixins in this way?
-
import std.stdio;
int fooTestMixin() {
return 5;
}
void main() {
enum t { fooTestMixin };
immutable string[] strArr = [ "fooTestMixin" ];
writeln(mixin(`mixin("t.fooTestMixin")`));
wri
On Friday, 24 April 2015 at 22:18:22 UTC, tom wrote:
On Friday, 24 April 2015 at 13:12:56 UTC, Jens Bauer wrote:
On Friday, 24 April 2015 at 07:34:55 UTC, tom wrote:
would something like a STM32 NUCLEO-F401RE work?
I forgot to give you a proper answer on this one: I think it
should work, as
On Wednesday, 29 April 2015 at 13:58:14 UTC, Artur Skawina wrote:
On 04/27/15 19:49, Jens Bauer via Digitalmars-d-learn wrote:
I was wondering if there's a way to reduce my bulky startup
files a bit.
{snip}
Just create a helper module, which the startup files can all
use to generate the data
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")
.byChunk(1024 * 1024) //1 MB. Data cluster equals 1024 *
Current std.stdio is deprecated. This ad-hoc should works.
auto json = File("fileName")
.byChunk(1024 * 1024) //1 MB. Data cluster equals 1024 * 4
.map!(ch => ch.idup)
.joiner
.map!(b => cast(char)b)
.parseJSO
fix:
completeSort(x.assumeSorted, y);
x = x.chain(y).uniq.array;
or
completeSort(x.assumeSorted, y.uniq.array);
x ~= y;
On Friday, 1 May 2015 at 19:34:20 UTC, Ilya Yaroshenko wrote:
If x is already sorted
x = x.completeSort(y).uniq.array;
On Friday, 1 May 20
If x is already sorted
x = x.completeSort(y).uniq.array;
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;
On Friday, 1 May 2015 at 19:08:51 UTC, Per N
Both variants are wrong because uniq needs sorted ranges.
Probably you need something like that:
x = x.chain(y).sort.uniq.array;
On Friday, 1 May 2015 at 19:08:51 UTC, Per Nordlöw wrote:
What's the fastest Phobos-way of doing either
x ~= y; // append
x = x.uniq; // remove duplicates
What's the fastest Phobos-way of doing either
x ~= y; // append
x = x.uniq; // remove duplicates
or
x = (x ~ y).uniq; // append and remove duplicates in one go
provided that
T[] x, y;
?
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 place. I need to be able to acquire/release shared
resour
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 place. I need to be able to acquire/release shared
resources reliably, like an OpenGL texture, for example.
If
On Wednesday, 29 April 2015 at 18:48:22 UTC, Laeeth Isharc wrote:
Hi.
What's the best way to pass the contents of a file to the
stream parser without reading the whole thing into memory
first? I get an error if using byLine because the kind of
range this function returns is not what the stre
Dennis Ritchie:
Anybody can write a packed array on the D? I once badly
represent the means by which we can write a packed array. Maybe
for this you should use core.simd or unions?
SIMD could be useful for some fancy bulk operations. But you
should be able to write a good basic packed array
On Friday, 1 May 2015 at 11:20:32 UTC, Chris wrote:
On Friday, 1 May 2015 at 11:11:28 UTC, biozic wrote:
On Friday, 1 May 2015 at 11:01:29 UTC, Chris wrote:
Thinking about it,
T factory(T)() {
return T();
}
is better suited for a factory (with static type checks).
But then I don't know w
On Friday, 1 May 2015 at 11:01:29 UTC, Chris wrote:
This aside, how would I get something to load dynamically? It's
either "mismatched function return type" or (with type check)
"variable X cannot be read at compile time":
void main(string[] args) {
auto type = args[1];
auto myType = factory
On Friday, 1 May 2015 at 11:11:28 UTC, biozic wrote:
On Friday, 1 May 2015 at 11:01:29 UTC, Chris wrote:
Thinking about it,
T factory(T)() {
return T();
}
is better suited for a factory (with static type checks).
But then I don't know what factory!X() provides that X() alone
doesn't.
http://radar.oreilly.com/2015/04/investigating-sparks-performance.html
"For many who use and deploy Apache Spark, knowing how to find
critical bottlenecks is extremely important. In a recent O’Reilly
webcast, Making Sense of Spark Performance, Spark committer and
PMC member Kay Ousterhout gave
On Friday, 1 May 2015 at 11:01:29 UTC, Chris wrote:
On Friday, 1 May 2015 at 10:47:22 UTC, Chris wrote:
On Friday, 1 May 2015 at 10:46:20 UTC, Chris wrote:
On Friday, 1 May 2015 at 10:27:16 UTC, biozic wrote:
On Friday, 1 May 2015 at 10:12:36 UTC, Chris wrote:
On Friday, 1 May 2015 at 10:04:4
On Thursday, 30 April 2015 at 11:20:55 UTC, bearophile wrote:
Dennis Ritchie:
There is an array of values to store each of which
sufficiently 6 bits.
As it is written down on the D?
You can't do it directly in D. Someone has to write a packed
array data structure to do it.
Bye,
bearophile
On Friday, 1 May 2015 at 10:47:22 UTC, Chris wrote:
On Friday, 1 May 2015 at 10:46:20 UTC, Chris wrote:
On Friday, 1 May 2015 at 10:27:16 UTC, biozic wrote:
On Friday, 1 May 2015 at 10:12:36 UTC, Chris wrote:
On Friday, 1 May 2015 at 10:04:46 UTC, Namespace wrote:
How about this:
struct
On Friday, 1 May 2015 at 03:34:53 UTC, Luigi wrote:
Hi everybody.
I am tring to use a function where its parameter is another
function, and at the same time are both already made - they
cannot be modified - and the second one has to be conditioned
before to be passed as argument.
Let's say
On Friday, 1 May 2015 at 10:46:20 UTC, Chris wrote:
On Friday, 1 May 2015 at 10:27:16 UTC, biozic wrote:
On Friday, 1 May 2015 at 10:12:36 UTC, Chris wrote:
On Friday, 1 May 2015 at 10:04:46 UTC, Namespace wrote:
How about this:
struct A {
int x = 42;
}
struct B {
int x = 7;
}
T factor
On Friday, 1 May 2015 at 10:27:16 UTC, biozic wrote:
On Friday, 1 May 2015 at 10:12:36 UTC, Chris wrote:
On Friday, 1 May 2015 at 10:04:46 UTC, Namespace wrote:
How about this:
struct A {
int x = 42;
}
struct B {
int x = 7;
}
T factory(T)() {
return T();
}
void main()
{
auto a = factor
On Friday, 1 May 2015 at 10:12:36 UTC, Chris wrote:
On Friday, 1 May 2015 at 10:04:46 UTC, Namespace wrote:
How about this:
struct A {
int x = 42;
}
struct B {
int x = 7;
}
T factory(T)() {
return T();
}
void main()
{
auto a = factory!(A);
}
That's what I was looking for, I j
On Friday, 1 May 2015 at 10:04:46 UTC, Namespace wrote:
How about this:
struct A {
int x = 42;
}
struct B {
int x = 7;
}
T factory(T)() {
return T();
}
void main()
{
auto a = factory!(A);
}
That's what I was looking for, I just couldn't get it right.
Thanks.
Rikki:
I w
On 1/05/2015 10:01 p.m., Chris wrote:
What would be the D equivalent of the factory pattern? This obviously
doesn't work:
struct A {
int x = 42;
}
struct B {
int x = 7;
}
auto factory(string type) {
if (type == "A")
return A();
else if (type == "B")
return B();
else
On Friday, 1 May 2015 at 10:04:46 UTC, Namespace wrote:
How about this:
struct A {
int x = 42;
}
struct B {
int x = 7;
}
T factory(T)() {
return T();
}
void main()
{
auto a = factory!(A);
}
Of course, you can restrict the type to A or B, or both:
T factory(T)() if (is
How about this:
struct A {
int x = 42;
}
struct B {
int x = 7;
}
T factory(T)() {
return T();
}
void main()
{
auto a = factory!(A);
}
What would be the D equivalent of the factory pattern? This
obviously doesn't work:
struct A {
int x = 42;
}
struct B {
int x = 7;
}
auto factory(string type) {
if (type == "A")
return A();
else if (type == "B")
return B();
else
return A(); // default
}
void main()
{
On Thursday, 30 April 2015 at 22:24:15 UTC, bearophile wrote:
Paul:
When compiled on a 64 bit machine, this line
int r = uniform(0, mobs.length);
".length" returns a size_t, and 0 is an int. uniform() probably
decides to unify those types to a size_t. A size_t is 32 bit on
32 bit machines
On 2015-05-01 00:52:57 +, Laeeth Isharc said:
Does dflags work ?
http://code.dlang.org/package-format
Hi, yes. Overlooked this one as d(ebug)flags. Thanks.
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
50 matches
Mail list logo