On Tuesday, 7 April 2015 at 06:37:50 UTC, Jonathan wrote:
static if (is(T == V))
Are static ifs always checked outside of runtime? Is it
possible for a static if condition to be undeterminable outside
of runtime, or would such a condition throw a compiler error?
'static if' is always run at
On Tuesday, 7 April 2015 at 05:51:33 UTC, yazd wrote:
On Tuesday, 7 April 2015 at 05:49:48 UTC, yazd wrote:
I got this to work with:
```
import std.stdio, std.file, std.csv, std.range;
void main()
{
std.file.write("test.csv", "0,1,abc\n2,3,def");
scope(exit) std.file.remove("te
Yes it is.
takeNone() take a char from a string.
So you are going to append a char (with code 5) on the next line.
If you replace that line with:
s ~= 65;
it will print "A". (65 is ascii code for letter 'A')
On Tuesday, 7 April 2015 at 02:24:00 UTC, Dennis Ritchie wrote:
Hi,
Is it OK?
Depends on how you fill aTUs.
For example if you slice the original string, it will be
preserved in memory. That's why parsers keep parsed substrings by
duplicating them - this can result in smaller memory footprint.
On Tuesday, 7 April 2015 at 08:49:58 UTC, Andrea Fontana wrote:
Yes it is.
takeNone() take a char from a string.
So you are going to append a char (with code 5) on the next
line.
If you replace that line with:
s ~= 65;
it will print "A". (65 is ascii code for letter 'A')
Thanks. I am awa
Many thanks for the feedback yazd! I've tested the approach with
a large csv file and it works fine. Unfortunately csvReader seems
very convenient but it is no speed daemon. To my dismay it was
much slower (about 4x) than a simple approach I am using in
Python, which is essentially equivalent t
On Tuesday, 7 April 2015 at 09:44:11 UTC, gjansen wrote:
Many thanks for the feedback yazd! I've tested the approach
with a large csv file and it works fine. Unfortunately
csvReader seems very convenient but it is no speed daemon. To
my dismay it was much slower (about 4x) than a simple approac
Hi, I think I have a bug report for DerelictGL3, but cannot find
the related Forum
( http://dblog.aldacron.net/forum/index.php ), is it still in the
process of being moved ?
Regards, ParticlePeter
On Tuesday, 7 April 2015 at 10:48:38 UTC, ParticlePeter wrote:
Hi, I think I have a bug report for DerelictGL3, but cannot
find the related Forum
( http://dblog.aldacron.net/forum/index.php ), is it still in
the process of being moved ?
Regards, ParticlePeter
Post it there: https://github.co
dmd -O (2.066.1) and gdc -O3 (4.9.2)
But... as I tried to convey, I was comparing apples to oranges. I
have now rewritten the D test simply using split(',') instead of
csvReader, to be more similar to the python test, and it runs
about 2x faster in D with dmd and about 4x faster with gdc
comp
On Tuesday, 7 April 2015 at 11:36:54 UTC, gjansen wrote:
dmd -O (2.066.1) and gdc -O3 (4.9.2)
But... as I tried to convey, I was comparing apples to oranges.
I have now rewritten the D test simply using split(',') instead
of csvReader, to be more similar to the python test, and it
runs about
On Monday, 6 April 2015 at 18:00:46 UTC, Szymon Gatner wrote:
Why is that? The use case is to provide a set of convenience
"extension methods" to a basic interface. Say, given:
This is not the only use case, another (maybe even more common)
use is to allow pipeline programming.
Example from
EDIT: mis-formatted previous snippet
import std.algorithm, std.stdio, std.range, std.conv;
void main()
{
stdin
.byLine
.filter!(s => !s.empty && s.front != '#’) // Filter with
this lambda function
.map!(s => s.to!double) // Map the strings to doubles
.array /
I have data in memory, and I want a function to take a part of
data for processing only. It will only read and won't change.
char[] importantData;
With Immutable,
void dataProcessor( string giveMeAllYourData ){}
dataProcessor( cast( immutable )( importantData[5 .. 14] ) );
With Const,
vo
On Tuesday, 7 April 2015 at 15:11:39 UTC, tcak wrote:
I have data in memory, and I want a function to take a part of
data for processing only. It will only read and won't change.
char[] importantData;
With Immutable,
void dataProcessor( string giveMeAllYourData ){}
dataProcessor( cast( immu
On Tuesday, 7 April 2015 at 09:03:19 UTC, Kagamin wrote:
For example if you slice the original string, it will be
preserved in memory. That's why parsers keep parsed substrings
by duplicating them - this can result in smaller memory
footprint.
H... Will you be able to give me an example o
On Tuesday, 7 April 2015 at 08:58:31 UTC, Kagamin wrote:
Depends on how you fill aTUs.
Ok, I will bite... ;-)
I have the wText string which could be 20 mgs or so, I start
finding pieces of data like this,
wText = wText[std.string.find(wText,"") + 5 .. $];
so, everything before , including i
If you're just looking at the data, use const. immutable becomes
more important if it is shared across threads or stored for later.
Functions that accept const will work with almost anything you
pass to it.
tcak:
void dataProcessor( string giveMeAllYourData ){}
dataProcessor( cast( immutable )( importantData[5 .. 14] ) );
With Const,
void dataProcessor( in char[] giveMeAllYourData ){}
dataProcessor( cast( const )( importantData[5 .. 14] ) );
Don't cast to const/immutable unless you have a g
On Tuesday, 7 April 2015 at 14:46:52 UTC, cym13 wrote:
EDIT: mis-formatted previous snippet
import std.algorithm, std.stdio, std.range, std.conv;
void main()
{
stdin
.byLine
.filter!(s => !s.empty && s.front != '#’) // Filter
with this lambda function
.map!(s => s.t
Hi!
Excuse me if this is obvious, but I can't recall coming across
anything similar and a quick search returns nothing relevant:
struct Foo {
}
struct FooWrapper {
alias x_ this;
private Foo* x_; // doesn't work, as x_ is private
}
Basically, I want x_ to never be visible, except through
Done
On Tuesday, 7 April 2015 at 10:50:35 UTC, Namespace wrote:
On Tuesday, 7 April 2015 at 10:48:38 UTC, ParticlePeter wrote:
Hi, I think I have a bug report for DerelictGL3, but cannot
find the related Forum
( http://dblog.aldacron.net/forum/index.php ), is it still in
the process of being m
On Tue, 07 Apr 2015 16:40:29 +
via Digitalmars-d-learn wrote:
> Hi!
>
> Excuse me if this is obvious, but I can't recall coming across
> anything similar and a quick search returns nothing relevant:
>
> struct Foo {
> }
>
> struct FooWrapper {
>alias x_ this;
>private Foo* x_; //
On Tuesday, 7 April 2015 at 15:51:59 UTC, bearophile wrote:
tcak:
void dataProcessor( string giveMeAllYourData ){}
dataProcessor( cast( immutable )( importantData[5 .. 14] ) );
With Const,
void dataProcessor( in char[] giveMeAllYourData ){}
dataProcessor( cast( const )( importantData[5 ..
On Tuesday, 7 April 2015 at 17:21:09 UTC, Daniel Kozak wrote:
On Tue, 07 Apr 2015 16:40:29 +
via Digitalmars-d-learn
wrote:
Hi!
Excuse me if this is obvious, but I can't recall coming across
anything similar and a quick search returns nothing relevant:
struct Foo {
}
struct FooWrap
On Tuesday, 7 April 2015 at 17:21:09 UTC, Daniel Kozak wrote:
On Tue, 07 Apr 2015 16:40:29 +
via Digitalmars-d-learn
wrote:
Hi!
Excuse me if this is obvious, but I can't recall coming across
anything similar and a quick search returns nothing relevant:
struct Foo {
}
struct FooWrap
On Tuesday, 7 April 2015 at 17:21:09 UTC, Daniel Kozak wrote:
On Tue, 07 Apr 2015 16:40:29 +
via Digitalmars-d-learn
wrote:
Hi!
Excuse me if this is obvious, but I can't recall coming across
anything similar and a quick search returns nothing relevant:
struct Foo {
}
struct FooWrap
On Tuesday, 7 April 2015 at 17:43:08 UTC, Daniel Kozak wrote:
On Tuesday, 7 April 2015 at 17:21:09 UTC, Daniel Kozak wrote:
On Tue, 07 Apr 2015 16:40:29 +
via Digitalmars-d-learn
wrote:
Hi!
Excuse me if this is obvious, but I can't recall coming
across anything similar and a quick se
On Tuesday, 7 April 2015 at 17:59:57 UTC, Daniel Kozak wrote:
On Tuesday, 7 April 2015 at 17:43:08 UTC, Daniel Kozak wrote:
On Tuesday, 7 April 2015 at 17:21:09 UTC, Daniel Kozak wrote:
On Tue, 07 Apr 2015 16:40:29 +
via Digitalmars-d-learn
wrote:
Hi!
Excuse me if this is obvious, bu
I'm currently working on a startup file for Cortex-M.
Thanks to Johannes, I'm now able to implement almost everything I
need.
While the most important part of the code code works, there are
still a few things, that I would like added/changed.
Here's a cut-down version of a start.d:
---8<
On Tuesday, 7 April 2015 at 20:33:26 UTC, Jens Bauer wrote:
Question number 1: How can a C subroutine be made optional, so
it's called only if it linked ?
Question 1 might be answered by the following thread:
http://forum.dlang.org/thread/mg1bad$30uk$1...@digitalmars.com
-So no need to answer q
Am 06.04.2015 um 17:45 schrieb Laeeth Isharc:
So a very basic question about using vibed for a REST service. I am
serving data using REST to another application. For the time being it
is internal so it is not a disaster if the fiber blocks. But I wanted
to understand what I should be doing - t
Am 05.04.2015 um 06:24 schrieb Sebastiaan Koppe:
(...)
I can probably use zip to get the quotes around the names, to avoid
concatenation. But it works fine the way it is. The problem is, the
following doesn't:
```
void csvRow(const Json jsonObject)
{
return values(jsonObject.get!(Json[strin
Am 26.03.2015 um 21:36 schrieb Steven Schveighoffer:
So I just noticed, when I click on "source code" button for a function
in dlang.org library preview, it brings me to the source code as of that
release, but to the file itself (on github).
I'd like it to go to the specific line where that func
Am 24.03.2015 um 06:36 schrieb Laeeth Isharc:
On Tuesday, 24 March 2015 at 04:53:39 UTC, Laeeth Isharc wrote:
Hi.
struct RawGoogleResults
{
string version_;
string status;
string sig;
string[string][][string] table;
}
enum json =
"{"version":"0.6","status":"ok","sig":"717451517
Am 26.03.2015 um 02:38 schrieb Laeeth Isharc:
On Thursday, 26 March 2015 at 01:04:06 UTC, Jakob Ovrum wrote:
On Thursday, 26 March 2015 at 00:41:50 UTC, Laeeth Isharc wrote:
Yeah, it is not very intuitive. But it works.
Thanks.
Next question - how can I correctly deal with inconsiderately ch
Am 20.03.2015 um 10:42 schrieb "István Zólyomi":
Still does not compile, thanks for the idea though. I think it's better
to avoid Temple, compilation of Diet templates seems to be better
anyway. E.g. temple seems to accept <% var.nonexistingname %> while diet
gives a compile error for #{nonexisti
On Tuesday, 7 April 2015 at 19:17:41 UTC, Márcio Martins wrote:>
Proxy doesn't really help here :(
Nothing will help you get around this. You have to expose a
public member and alias to that. Try wrapping the access in a
public zero-parameter member function.
You should start a worker thread for this and then use message
passing (vibe.core.concurrency) to wait for the results (or
alternatively a TaskCondition). I was thinking about including
a generic thread proxy in vibe.d that I've used to encapsulate
these details when working with libgit in a vi
On 8/04/2015 8:38 a.m., Jens Bauer wrote:
On Tuesday, 7 April 2015 at 20:33:26 UTC, Jens Bauer wrote:
Question number 1: How can a C subroutine be made optional, so it's
called only if it linked ?
Question 1 might be answered by the following thread:
http://forum.dlang.org/thread/mg1bad$30uk$1
Eg, code like this in std.algorithm:
assert(equal(setSymmetricDifference(a, b), [0, 5, 8, 9][]));
why not just:
assert(equal(setSymmetricDifference(a, b), [0, 5, 8, 9]));
?
On Wednesday, 8 April 2015 at 02:40:14 UTC, Timothee Cour wrote:
Eg, code like this in std.algorithm:
assert(equal(setSymmetricDifference(a, b), [0, 5, 8, 9][]));
why not just:
assert(equal(setSymmetricDifference(a, b), [0, 5, 8, 9]));
?
It's historic. DMD 2.041 changed the type of array litera
On 04/07/2015 07:40 PM, Timothee Cour via Digitalmars-d-learn wrote:
Eg, code like this in std.algorithm:
assert(equal(setSymmetricDifference(a, b), [0, 5, 8, 9][]));
why not just:
assert(equal(setSymmetricDifference(a, b), [0, 5, 8, 9]));
?
It must be a leftover from the time when the type of
I am planning to implement "Iterator" class. But looking at
"foreach" statement, it takes a range only.
So is there any way other than returning an array from a function
that is to be passed foreach statement? So I could write like
that:
Iterator iter = new MyList();
foreach(item; iter){
}
On 04/07/2015 10:59 PM, tcak wrote:
I am planning to implement "Iterator" class. But looking at "foreach"
statement, it takes a range only.
The other option is to overload opApply():
http://ddili.org/ders/d.en/foreach_opapply.html#ix_foreach_opapply.opApply
Ali
46 matches
Mail list logo