Is there any reason you couldn't (or would rather not) use structs rather
than tuples?
That would work. What would be the best way to auto-generate the types? I
have somewhere around 30 already, and the number will grow with this
project.
Evan Davis
Maybe you could use a struct template,
My recent
https://github.com/D-Programming-Language/dmd/pull/3606
fails in all the Auto-Testers but I don't understand why.
Running make unittest locally in phobos using my locally built
branch of dmd passes all tests.
Please help!
On Sat, 07 Jun 2014 08:56:37 +
Nordlöw via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
My recent
https://github.com/D-Programming-Language/dmd/pull/3606
fails in all the Auto-Testers but I don't understand why.
Running make unittest locally in phobos using my locally
On 06/06/2014 7:39 PM, Steven Schveighoffer wrote:
On Fri, 06 Jun 2014 06:14:30 -0400, Rene Zwanenburg
renezwanenb...@gmail.com wrote:
Immutables should be usable at compile time and not allocate a new
instance on every use when in module scope.
I was about to say this. But immutable can
On Saturday, 7 June 2014 at 09:19:55 UTC, Jonathan M Davis via
Digitalmars-d-learn wrote:
Also, you're probably going to need to use DMD= to set dmd to
the one that you
built in order to use the one that you built when building
druntime and Phobos
instead of the one you installed normally and
I've just noticed that in the .lst file for one of my libs the execution
counts stop lining up with the source, and the source itself is
truncated by a couple of lines. The function where the misalignment
begins contains an if (__ctfe) block (first time I ever used one) but
just testing that
On Saturday, 7 June 2014 at 00:48:59 UTC, hane wrote:
On Friday, 6 June 2014 at 15:42:41 UTC, Meta wrote:
You should not do this, as it will create a new regex
everywhere you use it. Unlike const or immutable, enum in this
situation is more or less like a C macro.
#define r1 regex(bla)
I
On Saturday, 7 June 2014 at 08:56:38 UTC, Nordlöw wrote:
My recent
https://github.com/D-Programming-Language/dmd/pull/3606
fails in all the Auto-Testers but I don't understand why.
Running make unittest locally in phobos using my locally built
branch of dmd passes all tests.
Please help!
Hello,
I'm looking to compile a server into a windows service, and there
doesn't seem to be any info out there except this :
http://forum.dlang.org/thread/c95ngs$1t0n$1...@digitaldaemon.com
It doesn't call rt_init, would that be the only thing missing from there?
Also, the d runtime seems
Given a single ddoc source file (with no D source), how can one
generate the default html output?
I have tried: dmd -D -main ddoc.ddoc
and get nothing except __main.* files with no documentation.
Do I have to use CanDyDoc or bootDoc? They seem like overkill for a
first effort.
Thanks.
-Tom
On Friday, 6 June 2014 at 17:02:33 UTC, K.K. wrote:
Oh okay, I get what you mean. I guess I was really over
complicating it then? xD
Yea, I think a lot of people do: building C++ takes some extra
steps out of necessity that you can just ignore in D for the most
part :)
Thanks for the help
On Saturday, 7 June 2014 at 14:41:15 UTC, Etienne Cimon wrote:
no documentation though. Any idea how to attach/detach with a
known example? I'd also like to create a windows DLL that
compiles through DMD/GDC/LDC with extern(c) so that folks from
C++ can link with it .
Check this out:
On Saturday, 7 June 2014 at 11:33:35 UTC, Meta wrote:
On Saturday, 7 June 2014 at 00:48:59 UTC, hane wrote:
On Friday, 6 June 2014 at 15:42:41 UTC, Meta wrote:
You should not do this, as it will create a new regex
everywhere you use it. Unlike const or immutable, enum in
this situation is
On Saturday, 7 June 2014 at 16:07:47 UTC, Adam D. Ruppe wrote:
On Saturday, 7 June 2014 at 14:41:15 UTC, Etienne Cimon wrote:
no documentation though. Any idea how to attach/detach with a
known example? I'd also like to create a windows DLL that
compiles through DMD/GDC/LDC with extern(c) so
On Friday, 6 June 2014 at 14:21:38 UTC, Rene Zwanenburg wrote:
Please try compiling with -g (generate debug info). The magic
numbers should turn into a stack trace, so you know where the
assert is triggered.
This helped quite a bit. The program was hitting an assert(0)
which I had ruled out
I am very new to D. How do I add elements to a dynamic array of
dynamic array.
This is my code that fails to compile.
void ex1()
{
alias the_row = string[];
alias the_table = the_row[];
File inFile = File(account.txt, r);
while (!inFile.eof())
{
katuday:
I am very new to D.
Welcome to D :-)
alias the_row = string[];
alias the_table = the_row[];
Here you are defining two types (and in D idiomatically types are
written in CamelCase, so TheRow and TheTable).
File inFile = File(account.txt, r);
This is
Hello all,
Just a quick check -- which version of the dmd frontend introduces support for
the notation T(n) to initialize a variable as type T? Is it 2.065 or the
upcoming 2.066? I ask because as I'm always running git-HEAD DMD, I'm never
entirely on top of what's in which version ... :-)
Joseph Rushton Wakeling:
which version of the dmd frontend introduces support for the
notation T(n) to initialize a variable as type T? Is it 2.065
or the upcoming 2.066?
In 2.066.
Bye,
bearophile
Well, it doesn't work in 2.065, so must be 2.066 :-)
P.S. thanks for letting me know about this feature. I had no idea
it was going in!
On Saturday, 7 June 2014 at 16:15:47 UTC, hane wrote:
At std.regex.
BTW, I found that immutable regex can be created with enum.
enum r1_ = regex(bla);
immutable r1 = r1_;
Regex struct created during compiling can be immutable?
In this case, it must be using enum to force CTFE. As for
I have a dynamic array of dynamic array of strings
I want to sort the outer array based on specific columns of the
inner array
This is how I am populating the 2D array
void readFromFile()
{
alias Row = string[];
alias Table = Row[];
Row the_row;
Table
On Saturday, 7 June 2014 at 19:10:19 UTC, katuday wrote:
I am looking for something like boost::variant in C++
Like this?
http://dlang.org/phobos/std_variant.html
This is my attemot to create a compare object. But I don't know
how to use it together with .sort member function
Don't use the .sort property. Use std.algorithm.sort, which has a
less predicate (that should return a bool).
http://dlang.org/phobos/std_algorithm.html#sort
On Saturday, 7 June 2014 at 19:10:53 UTC, Chris Cain wrote:
On Saturday, 7 June 2014 at 19:10:19 UTC, katuday wrote:
I am looking for something like boost::variant in C++
Like this?
http://dlang.org/phobos/std_variant.html
Thank you.
On Saturday, 7 June 2014 at 19:14:01 UTC, Chris Cain wrote:
This is my attemot to create a compare object. But I don't
know how to use it together with .sort member function
Don't use the .sort property. Use std.algorithm.sort, which has
a less predicate (that should return a bool).
On 06/07/2014 12:18 PM, Chris Cain wrote:
Also note that the examples use a string to define the predicate, but it
accepts functions as well. Such as:
bool myCompareFunc(AType lhs, AType rhs)
{
return lhs.blah rhs.blah;
}
//...
AType[] arr;
//...
On 07/06/14 19:57, Peter Alexander via Digitalmars-d-learn wrote:
Well, it doesn't work in 2.065, so must be 2.066 :-)
P.S. thanks for letting me know about this feature. I had no idea it was going
in!
I only discovered it when I was advised to use it in a recent Phobos PR of
mine. :-)
The
On 07/06/14 19:57, bearophile via Digitalmars-d-learn wrote:
Joseph Rushton Wakeling:
which version of the dmd frontend introduces support for the notation T(n) to
initialize a variable as type T? Is it 2.065 or the upcoming 2.066?
In 2.066.
Thanks for the confirmation :-)
I am trying to make a binding for the Jack Audio Connection Kit, which I
figured would be a good exercise to start and hopefully to replace C++ for my
long term audio work.
I am making good progress (complete C API covered), and currently I am hitting
a brick wall where delegates are concerned,
On Saturday, 7 June 2014 at 20:04:41 UTC, Denis Martinez via
Digitalmars-d-learn wrote:
int ret = jack_set_process_callback(handle_, f, dg);
dg here is giving you a pointer to the dg variable sitting on
the stack. The stack is almost certainly getting overwritten at
some point.
On Saturday, 7 June 2014 at 20:47:31 UTC, katuday wrote:
On Saturday, 7 June 2014 at 19:18:34 UTC, Chris Cain wrote:
On Saturday, 7 June 2014 at 19:14:01 UTC, Chris Cain wrote:
This is my attemot to create a compare object. But I don't
know how to use it together with .sort member function
On Saturday, 7 June 2014 at 20:53:03 UTC, Paul wrote:
I can not understand, why this code works:
char s[2] = ['0', 'A'];
string ss = to!string(s);
writeln(parse!uint(ss, 16));
but this can deduces template:
char s[2] = ['0', 'A'];
writeln(parse!uint(to!string(s), 16));
On Saturday, 7 June 2014 at 20:56:14 UTC, Paul wrote:
Dynamic array is really reference. Right? But why modification
of parameter in this case does not work:
void some_func(string[] s) {
s ~= xxx; s ~= yyy;
}
but this works:
void some_fun(ref string[] s) {
s ~= xxx; s ~= yyy;
}
In the 1st
On Saturday, 7 June 2014 at 20:53:03 UTC, Paul wrote:
I can not understand, why this code works:
char s[2] = ['0', 'A'];
string ss = to!string(s);
writeln(parse!uint(ss, 16));
but this can deduces template:
char s[2] = ['0', 'A'];
writeln(parse!uint(to!string(s), 16));
On Saturday, 7 June 2014 at 20:37:48 UTC, Chris Cain wrote:
On Saturday, 7 June 2014 at 20:21:26 UTC, Chris Cain wrote:
On Saturday, 7 June 2014 at 20:04:41 UTC, Denis Martinez via
Digitalmars-d-learn wrote:
int ret = jack_set_process_callback(handle_, f, dg);
dg here is giving you a
On Saturday, 7 June 2014 at 21:15:37 UTC, monarch_dodra wrote:
On Saturday, 7 June 2014 at 20:53:03 UTC, Paul wrote:
I can not understand, why this code works:
char s[2] = ['0', 'A'];
string ss = to!string(s);
writeln(parse!uint(ss, 16));
but this can deduces template:
char s[2]
On Sat, 07 Jun 2014 20:56:13 +
Paul via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
Dynamic array is really reference. Right? But why modification of
parameter in this case does not work:
void some_func(string[] s) {
s ~= xxx; s ~= yyy;
}
but this works:
void
On Saturday, 7 June 2014 at 21:17:41 UTC, monarch_dodra wrote:
On Saturday, 7 June 2014 at 20:56:14 UTC, Paul wrote:
Dynamic array is really reference. Right? But why modification
of parameter in this case does not work:
void some_func(string[] s) {
s ~= xxx; s ~= yyy;
}
but this works:
On Saturday, 7 June 2014 at 21:32:08 UTC, Jonathan M Davis via
Digitalmars-d-learn wrote:
On Sat, 07 Jun 2014 20:56:13 +
Paul via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
Dynamic array is really reference. Right? But why modification
of
parameter in this case does
On Friday, 6 June 2014 at 12:08:40 UTC, Rikki Cattermole wrote:
In none of your examples you have not defined the type of the
variables. However you are giving it an access modifier.
I assume you are wanting auto
D does not require providing a type if const/immutable is use. I
think at this
Hi.
I've found some code
import std.stdio, std.algorithm;
void permutationSort(T)(T[] items) pure nothrow {
while (items.nextPermutation) {}
}
void main() {
auto data = [2, 7, 4, 3, 5, 1, 0, 9, 8, 6, -1];
data.permutationSort;
data.writeln;
}
This code is running very slow
On Saturday, 7 June 2014 at 21:18:39 UTC, Denis Martinez wrote:
Thanks for the answer Chris, you are correct.
I was expecting the closure to work similarly to Clang's
blocks, which apparently it does not. I guess that delegates
pass by copy, like structs do.
So far I have tried a variety of
On Saturday, 7 June 2014 at 21:40:08 UTC, Agora wrote:
Why is running slow?
One of the main reasons is because the number of permutations an
array has is n!. Thus the expected runtime is O(n!). That's a
slow, slow algorithm in general. In particular, your array with
length 11 has 39,916,800
Thank you. I can not resolve it in quicker time, right?
Also:
dlang online compiler and dpaste:
return code: 9 killed
why?
thank you
On Saturday, 7 June 2014 at 21:57:31 UTC, Chris Cain wrote:
On Saturday, 7 June 2014 at 21:40:08 UTC, Agora wrote:
Why is running slow?
One of the main
On Saturday, 7 June 2014 at 22:01:25 UTC, Ali GOREN wrote:
Thank you. I can not resolve it in quicker time, right?
You might be able to come up with a faster way to permute, but
it's mostly pointless because it will always be very slow. Use
std.algorithm.sort if you want to sort quickly, as
Thank you Chris. Now I understand. I thought myself incorrectly
but this was a normal.
On Saturday, 7 June 2014 at 22:09:11 UTC, Chris Cain wrote:
On Saturday, 7 June 2014 at 22:01:25 UTC, Ali GOREN wrote:
Thank you. I can not resolve it in quicker time, right?
You might be able to come up
See my answer to this:
http://stackoverflow.com/questions/22845175/pass-delegates-to-external-c-functions-in-d
Since a delegate is two pointers and most C functions expect only
one pointer, you need to do some kind of magic. There's one
solution. Another is if the C function can pass a void*
On Sat, 07 Jun 2014 20:53:02 +
Paul via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
I can not understand, why this code works:
char s[2] = ['0', 'A'];
string ss = to!string(s);
writeln(parse!uint(ss, 16));
but this can deduces template:
char s[2]
49 matches
Mail list logo