On 08/14/2015 05:12 AM, H. S. Teoh via Digitalmars-d-learn wrote:
On Fri, Aug 14, 2015 at 02:42:26AM +, Laeeth Isharc via Digitalmars-d-learn
wrote:
I have a range that is an array of structs. I would like to iterate
through the range, calling a function with the prior k items in the
range
On 08/14/2015 03:26 PM, Timon Gehr wrote:
On 08/14/2015 05:12 AM, H. S. Teoh via Digitalmars-d-learn wrote:
...
I didn't figure out how to eliminate the short slices toward the end,
...
:o)
...
Less hacky and less efficient:
auto slidingWindow(R)(R range, int k) {
return iota(k).map!(
On 08/13/2015 06:05 PM, Steven Schveighoffer wrote:
On 8/13/15 11:59 AM, Steven Schveighoffer wrote:
That is definitely a bug. It's because typeid is looking up the derived
type via the vtable, but the compiler should rewrap it with 'shared'
afterwards.
Actually, now that I think about it, I'
On 08/15/2015 01:25 PM, vladde wrote:
I made a PR to phobos where I modified `std.format.format`.
https://github.com/D-Programming-Language/phobos/pull/3528
However the auto builder fails, with the error message:
runnable/test23.d(1219): Error: cannot implicitly convert expression
(format("s =
On 08/15/2015 01:54 PM, Timon Gehr wrote:
On 08/15/2015 01:25 PM, vladde wrote:
I made a PR to phobos where I modified `std.format.format`.
https://github.com/D-Programming-Language/phobos/pull/3528
However the auto builder fails, with the error message:
runnable/test23.d(1219): Error: cannot
On 08/20/2015 01:41 AM, Laeeth Isharc wrote:
BTW I don't know why you can't convert a char[] to string - seems
harmless enough conversion that way around.
It would need to allocate a new string, otherwise, one would be able to
modify the contents of the immutable string via the char[] referen
On 08/20/2015 02:02 AM, Laeeth Isharc wrote:
On Thursday, 20 August 2015 at 00:00:55 UTC, Timon Gehr wrote:
On 08/20/2015 01:41 AM, Laeeth Isharc wrote:
BTW I don't know why you can't convert a char[] to string - seems
harmless enough conversion that way around.
It would need to allocate a n
On 08/25/2015 08:29 PM, Vladimir Panteleev wrote:
I think this is a bug, but is easily worked around with:
auto test(string a) {
return .test(a, "b");
}
I suspect that the reason the error occurs, is that the auto return type
automatically rewrites the function declaration into an eponymo
On 08/26/2015 09:55 PM, Timon Gehr wrote:
On 08/25/2015 08:29 PM, Vladimir Panteleev wrote:
I think this is a bug, but is easily worked around with:
auto test(string a) {
return .test(a, "b");
}
I suspect that the reason the error occurs, is that the auto return type
automatically rewrit
On 08/30/2015 07:02 PM, Spacen Jasset wrote:
I have just added an opDiv to this class, but it doesn't seem to pick it
up.
math/vector.d(30): Error: 'this /= mag' is not a scalar, it is a Vector3
I can't see why that is, becuase my opMul works in the same place. Can
anyone point out what I have d
On 09/04/2015 09:39 PM, Paul wrote:
I discovered the other day (during a cut and paste malfunction!) that
it's possible to have code before the first case in a switch. Google
tells me that it's legal C code and something I read said it could be
used for initialization but was rather vague.
void
On 09/04/2015 11:12 PM, anonymous wrote:
On Friday 04 September 2015 23:04, Timon Gehr wrote:
DMD never warns about dead code.
It warns here:
import std.stdio;
void main()
{
return;
writeln("hi"); /* Warning: statement is not reachable */
}
You are right, it does. Then
On 09/17/2015 09:47 PM, ddos wrote:
yeah i tried for(;;) and it generates the same warning :)
sure, here is the full example, it's not too long anyways
( the example doesn't make much sense tho because socket.accept is
blocking :P )
http://pastebin.com/9K0wRRD6
ps: pastebin needs D support :-D
On 04.11.2016 09:04, Jacob Carlborg wrote:
I have a file with a bunch of lines I want to process. I want to process
these lines line by line. Most of these lines have the same pattern.
Some of the lines have a different pattern. I want to bundle those
lines, which have a non-standard pattern, tog
On 01.12.2016 21:12, Ali Çehreli wrote:
This is a common issue with D and some other languages (as I had learned
during a Dart language presentation, of which Dart does not suffer
from). All those delegates do close on the same loop variable. You need
to produce copies of the variable.
This i
On 14.12.2016 00:00, Timothee Cour via Digitalmars-d-learn wrote:
what's the best (and DRY) way to achieve:
```
static if(__traits(compiles, expr))
fun(expr);
```
ie, without repeating the expression inside expr?
eg:
```
static if(__traits(compiles, foo.bar[2])){
counter++;
writeln(" ex
On 15.12.2016 01:38, Basile B. wrote:
On Wednesday, 14 December 2016 at 22:06:35 UTC, Ali Çehreli wrote:
On 12/14/2016 09:25 AM, Basile B. wrote:
> On Tuesday, 13 December 2016 at 23:37:59 UTC, Timon Gehr
wrote:
>> I usually do
>>
>> enum code = q{expr};
>> static if(__traits(compiles,mixin(cod
On 08.01.2017 08:52, Elronnd wrote:
I'm working on writing an RSA implementation, but I've run into a
roadblock generating primes. With a more than 9 bits, my program either
hangs for a long time (utilizing %100 CPU!) or returns a composite
number. With 9 or fewer bits, I get primes, but I have
On 10.01.2017 04:02, Elronnd wrote:
Thank you! Would you mind telling me what you changed aside from pow()
and powm()?
1. This code:
// make 2^a = integer-1
while ((integer-1)%(pow(bigint(2), a))!=0)
a--;
m = (integer-1) / pow(bigint(2), a);
a starts out as integer-1, so this computes ma
On 08.06.2017 03:57, Andrew Edwards wrote:
Ranges may be finite or infinite but, while the destination may be
unreachable, we can definitely tell how far we've traveled. So why
doesn't this work?
import std.traits;
import std.range;
void main()
{
string[string] aa;
// what others h
On 08.06.2017 14:06, Steven Schveighoffer wrote:
The issue here is that arrays are special. Arrays allow foreach(i, v;
arr) and foreach(v; arr). Ranges in general do not. So there is no way
to forward this capability via the range interface. Not only that, but
foreach(i, v; arr) is much diffe
On 9/23/24 21:52, Craig Dillabaugh wrote:
Why does the following program:
\
import std.stdio;
int main(string[] args) {
uint Q = 7681;
writeln("Val = ", -1 % Q);
return 0;
}
\
Print
Val = 5568
Was hopin
101 - 122 of 122 matches
Mail list logo