Re: DLang Front Page Code Example

2014-05-22 Thread bearophile via Digitalmars-d-learn
Nicholas Londey: So I tried rewriting the example on the dlang.org home page and came up with the following. import std.algorithm, std.exception, std.stdio; double average(T)(T range) { enforce(!range.empty, "No inputs"); auto totals = range.map!(a => tuple(1.0, cast(double)(a))).reduce

Re: Template mixins has no effect

2014-05-22 Thread Nordlöw
What is wrong? Ping, anybody?

Separate Piping of dmd stdout and stderr through ddemangle

2014-05-22 Thread Nordlöw
Is there a Bash way to pipe stdout and stderr *separately* through ddemangle? I'm aware of 2>&1 but this removes separation of stdout and stderr.

Re: Separate Piping of dmd stdout and stderr through ddemangle

2014-05-22 Thread simendsjo via Digitalmars-d-learn
On 05/22/2014 11:29 AM, "Nordlöw" wrote: > Is there a Bash way to pipe stdout and stderr *separately* through > ddemangle? > > I'm aware of > > 2>&1 > > but this removes separation of stdout and stderr. 2>&1 means "redirect file handle 2 to the same as file handle 1". So it will redirect st

Re: Separate Piping of dmd stdout and stderr through ddemangle

2014-05-22 Thread via Digitalmars-d-learn
On Thursday, 22 May 2014 at 09:29:49 UTC, Nordlöw wrote: Is there a Bash way to pipe stdout and stderr *separately* through ddemangle? I'm aware of 2>&1 but this removes separation of stdout and stderr. You can use process substitution [1]: dmd ... 2> >( ddemangle >&2 ) (or leave out

Programming a Game in D? :D

2014-05-22 Thread David via Digitalmars-d-learn
Hey, I'm really new to D, and pretty new to programming overall too, But I want to make a 3d Game, (just sth. small). I really like D and want to do it in D, but in the Internet there is no shit about programming a game in D ^^ Is there any engine written in D? For example the CryEngine is for

Re: Programming a Game in D? :D

2014-05-22 Thread John Colvin via Digitalmars-d-learn
On Thursday, 22 May 2014 at 15:39:36 UTC, David wrote: Hey, I'm really new to D, and pretty new to programming overall too, But I want to make a 3d Game, (just sth. small). I really like D and want to do it in D, but in the Internet there is no shit about programming a game in D ^^ Is there an

Re: Programming a Game in D? :D

2014-05-22 Thread Francesco Cattoglio via Digitalmars-d-learn
On Thursday, 22 May 2014 at 15:48:50 UTC, John Colvin wrote: On Thursday, 22 May 2014 at 15:39:36 UTC, David wrote: Hey, I'm really new to D, and pretty new to programming overall too, But I want to make a 3d Game, (just sth. small). I really like D and want to do it in D, but in the Internet t

Re: Programming a Game in D? :D

2014-05-22 Thread Gary Willoughby via Digitalmars-d-learn
On Thursday, 22 May 2014 at 15:39:36 UTC, David wrote: Hey, I'm really new to D, and pretty new to programming overall too, But I want to make a 3d Game, (just sth. small). I really like D and want to do it in D, but in the Internet there is no shit about programming a game in D ^^ Is there an

Attach and detach C threads to D runtime

2014-05-22 Thread David Soria Parra via Digitalmars-d-learn
Hi, I am currently writing a fuse wrapper for D and try to support fuse multithreading which is based on pthreads. However fuse doesn't offer me a proper way to hook into the creation and joining process of threads. I can attach the threads created by libfuse but cannot find a way to properly det

How to get array length

2014-05-22 Thread kaz via Digitalmars-d-learn
Is there a way to get the length of an array out of slice bracket in D? Tks.

Re: How to get array length

2014-05-22 Thread Brad Anderson via Digitalmars-d-learn
On Thursday, 22 May 2014 at 23:22:44 UTC, kaz wrote: Is there a way to get the length of an array out of slice bracket in D? Tks. Just use .length: void main() { import std.stdio; auto a = new int[5]; auto b = a[]; writeln(a.length, " ", b.length); }

Re: dxl (the d port of jexcelapi)

2014-05-22 Thread Ellery Newcomer via Digitalmars-d-learn
On Thursday, 8 May 2014 at 20:57:08 UTC, Taylor Hillegeist wrote: So i was thinking i wonder if anyone has a d library for excel and behold there it was. however, it seems like d has grown since this was written. I'm getting bunches of errors telling me that i can't override a function withou

Re: How to get array length

2014-05-22 Thread Ali Çehreli via Digitalmars-d-learn
On 05/22/2014 04:22 PM, kaz wrote: Is there a way to get the length of an array out of slice bracket in D? Tks. If you mean the length of the original array, no. Of course, the length of the slice is trivial: slice.length. The following article explains how slices don't know about other sli

How to get struct's members ?

2014-05-22 Thread bioinfornatics via Digitalmars-d-learn
Dear, I would like to get struct's members and zip them with an action as struct A { int a; int b; } std.range.zip( __traits( allmembers, A ), [(x) => x == 0, (y) => y > 3] ); like this i could apply an action to each field. I tried this: http://dpaste.dzfl.pl/747799ffa64e but: tuple

Re: dxl (the d port of jexcelapi)

2014-05-22 Thread bioinfornatics via Digitalmars-d-learn
On Thursday, 8 May 2014 at 20:57:08 UTC, Taylor Hillegeist wrote: So i was thinking i wonder if anyone has a d library for excel and behold there it was. however, it seems like d has grown since this was written. I'm getting bunches of errors telling me that i can't override a function withou

Re: How to get struct's members ?

2014-05-22 Thread Adam D. Ruppe via Digitalmars-d-learn
allMembers yields the names of all the members. Try .tupleof on an object instead, that might work better.

Re: Attach and detach C threads to D runtime

2014-05-22 Thread Sean Kelly via Digitalmars-d-learn
On Thursday, 22 May 2014 at 19:21:26 UTC, David Soria Parra via Digitalmars-d-learn wrote: I know that thread_detachByAddr exists, but the Thread object from Thread.getAll or Thread.opApply doesn't expose the thread address. Would thread_detachThis work for you? Alternately, you can use pt

Re: std.concurrency bug?

2014-05-22 Thread Sean Kelly via Digitalmars-d-learn
On Wednesday, 21 May 2014 at 20:19:32 UTC, Ali Çehreli wrote: I think this is a known issue with immutable and Variant, which std.concurrency uses for unknown messages. This looks related: https://issues.dlang.org/show_bug.cgi?id=5538 std.concurrency actually uses Variant as the transport

Re: How to get struct's members ?

2014-05-22 Thread monarch_dodra via Digitalmars-d-learn
On Friday, 23 May 2014 at 01:17:18 UTC, bioinfornatics wrote: Dear, I would like to get struct's members and zip them with an action as struct A { int a; int b; } std.range.zip( __traits( allmembers, A ), [(x) => x == 0, (y) => y > 3] ); like this i could apply an action to each field.