Hello, I'm on day 2 of learning D. I've learned C, C++, Java,
Python, Ruby in University, but I wanted to broaden my palette by
picking up D.
This project is a basic implementation of Project Euler problem
10. I build an array of primes, and for each new test number I
check if the test is
On 10/29/2013 11:04 PM, Zeke wrote:
lowerBound and friends are related:
http://dlang.org/phobos/std_range.html#.lowerBound
Ali
Logesh Pillay:
using struct as a key to an associative array worked fine
without opHash and other special methods.
It works as long as you don't put reference types (like dynamic
arrays and strings) as members of that struct.
Bye,
bearophile
Chris Cain:
InputRange!Tree walk()
{
return inputRangeObject(chain(
[this],
children.map!(a=a.walk())().joiner()));
}
I have used your nice idea to create another partial D solution
for this task:
http://rosettacode.org/wiki/Tree_traversal#D
On Wednesday, 30 October 2013 at 06:04:36 UTC, Zeke wrote:
Hello, I'm on day 2 of learning D. I've learned C, C++, Java,
Python, Ruby in University, but I wanted to broaden my palette
by picking up D.
This project is a basic implementation of Project Euler problem
10. I build an array of
On 10/30/13, Chris Cain clc...@uncg.edu wrote:
I'm not confident that this is the most efficient way, but it
works.
It allocates, I'm looking for a lazy range. I would be surprised that
such a common task as iterating a tree is not possible without using
classes and workarounds.
Am 30.10.2013 04:18, schrieb evilrat:
On Tuesday, 29 October 2013 at 19:40:40 UTC, Benjamin Thaut wrote:
omg! i can't believe this :(
i have tried this too
first(http://www.dsource.org/projects/bindings/wiki/DirectX), and it was
somewhat crappy, so i start my own tranlation, all was fine until
Am 30.10.2013 15:58, schrieb Andrej Mitrovic:
On 10/30/13, Chris Cain clc...@uncg.edu wrote:
I'm not confident that this is the most efficient way, but it
works.
It allocates, I'm looking for a lazy range. I would be surprised that
such a common task as iterating a tree is not possible
On Wednesday, 30 October 2013 at 15:18:57 UTC, Benjamin Thaut
wrote:
Well we all make problems. Give me a note when you are done
with complete directx bindings as I'm also interrested in
having minimal up to date directx bindings.
Also its always apperciated to thank you a person which
On Wednesday, 30 October 2013 at 14:58:21 UTC, Andrej Mitrovic
wrote:
It allocates, I'm looking for a lazy range. I would be
surprised that
such a common task as iterating a tree is not possible without
using
classes and workarounds.
It allocates, but it's still a lazy range. It only
On Wednesday, 30 October 2013 at 12:55:41 UTC, bearophile wrote:
I have used your nice idea to create another partial D solution
for this task:
http://rosettacode.org/wiki/Tree_traversal#D
... snip ...
Very cool! It's pretty close to being done. I'd have to give some
real thought to how a
Am 30.10.2013 17:53, schrieb evilrat:
On Wednesday, 30 October 2013 at 15:18:57 UTC, Benjamin Thaut wrote:
Well we all make problems. Give me a note when you are done with
complete directx bindings as I'm also interrested in having minimal up
to date directx bindings.
Also its always
On Wednesday, 30 October 2013 at 16:50:33 UTC, Chris Cain wrote:
you would avoid allocations.
Actually, let me clarify. You'd avoid *those* allocations.
inputRangeObject allocates a class. Unfortunately, I'm not
certain it's possible to do this cleanly without such a thing
using
On Wed, Oct 30, 2013 at 1:55 PM, bearophile bearophileh...@lycos.comwrote:
alias VisitRange(T) = InputRange!(const Tree!T);
Does that syntax come with DMD 2.064? The (T) part, I mean.
On Wednesday, 30 October 2013 at 17:31:10 UTC, Philippe Sigaud
wrote:
On Wed, Oct 30, 2013 at 1:55 PM, bearophile
bearophileh...@lycos.comwrote:
alias VisitRange(T) = InputRange!(const Tree!T);
Does that syntax come with DMD 2.064? The (T) part, I mean.
Yes.
On 10/30/13, Philippe Sigaud philippe.sig...@gmail.com wrote:
Does that syntax come with DMD 2.064? The (T) part, I mean.
Yes.
Glad to see you here btw, do you have your own solution to the problem?
On 10/29/2013 06:02 PM, Peter Eisenhower wrote:
I am confused as to why I cannot pass the return of the tag attribute
directly into the parse int.
// This works
string s = xml.tag.attr[key];
int key = parse!int(s);
// Compile error on these
int key = parse!int(xml.tag.attr[key]);
int key =
On Wed, Oct 30, 2013 at 7:09 PM, Andrej Mitrovic andrej.mitrov...@gmail.com
wrote:
On 10/30/13, Philippe Sigaud philippe.sig...@gmail.com wrote:
Does that syntax come with DMD 2.064? The (T) part, I mean.
Yes.
Ah, that's cool! I've been waiting for that one for years.
Glad to see you
On Wednesday, 30 October 2013 at 14:17:22 UTC, qznc wrote:
Why do you want to find the exact prime first? Just check
against sqrt(num) in the loop.
auto upper = cast(ulong)sqrt(cast(double)num)) + 1;
foreach(ulong prime; primes) {
if (prime upper) return true;
if (num % prime == 0) return
On Wednesday, 30 October 2013 at 06:10:59 UTC, Ali Çehreli wrote:
On 10/29/2013 11:04 PM, Zeke wrote:
lowerBound and friends are related:
http://dlang.org/phobos/std_range.html#.lowerBound
Ali
lowerBound returns a range with the last value being the sqrt, so
I can't directly iterate over
Hello,
I am writing code that uses a structure containing an array of
points where the points may be of arbitrary dimension (though
generally small). I would like to be able to pass the point
dimension to my structure as a template parameter.
One solution is to create instances of these
It won't really work on the command line alone, but the way I do
it is a two step thing. First, make the thing use a config module:
import myproject.config;
alias Thing Thing_Impl!dim;
then you go ahead and use Thing, which is instantiated with the
dimension. Then the user makes a file:
On Wednesday, 30 October 2013 at 18:56:42 UTC, Zeke wrote:
On Wednesday, 30 October 2013 at 14:17:22 UTC, qznc wrote:
Why do you want to find the exact prime first? Just check
against sqrt(num) in the loop.
auto upper = cast(ulong)sqrt(cast(double)num)) + 1;
foreach(ulong prime; primes) {
if
On 10/30/2013 01:11 PM, Craig Dillabaugh wrote:
I am writing code that uses a structure containing an array of
points where the points may be of arbitrary dimension (though
generally small). I would like to be able to pass the point
dimension to my structure as a template parameter.
struct
On Wednesday, 30 October 2013 at 20:19:11 UTC, Adam D. Ruppe
wrote:
It won't really work on the command line alone, but the way I
do it is a two step thing. First, make the thing use a config
module:
import myproject.config;
alias Thing Thing_Impl!dim;
then you go ahead and use Thing, which
On Wednesday, 30 October 2013 at 00:20:12 UTC, Stephan Schiffels
wrote:
Hi,
I'd like a version of std.range.chunk that does not require the
range to have the length property.
As an example, consider a file that you would like parse by
lines and always lump together four lines, i.e.
import
On Wednesday, 30 October 2013 at 20:23:58 UTC, Ali Çehreli wrote:
On 10/30/2013 01:11 PM, Craig Dillabaugh wrote:
I am writing code that uses a structure containing an array of
points where the points may be of arbitrary dimension (though
generally small). I would like to be able to pass
I'm trying to design a plug-in system for my game, and i would
like to share static members from both context (Application,
Shared Library). I found out that i can get the address of a
__gshared at compile time, so my question is, is it possible to
build an associative array at compile-time?
Using --debug or --release works fine. But when i use --profile i
get:
c:\Program Files
(x86)\DLang\dmd2\windows\bin\..\..\src\phobos\std\path.d(2187):
Error: balancedParens is not nothrow
c:\Program Files
(x86)\DLang\dmd2\windows\bin\..\..\src\phobos\std\path.d(2188):
Error:
29 matches
Mail list logo