Re: CMake for D

2014-03-24 Thread ed
On Monday, 24 March 2014 at 05:44:37 UTC, Igor wrote: On Tuesday, 14 February 2012 at 07:35:26 UTC, Gour wrote: On Tue, 14 Feb 2012 01:37:20 +0100 bioinfornatics bioinfornat...@fedoraproject.org wrote: Maybe send a pull request to main cmake repo will be better. It is always better to put

Re: Template with template?

2014-03-24 Thread Chris
On Sunday, 23 March 2014 at 12:37:34 UTC, Marc Schütz wrote: On Friday, 21 March 2014 at 09:56:49 UTC, Chris wrote: Btw, I was initially inspired by Objective-C's NSSet that can hold arbitrary objects. That's because Objective-C's objects are references. It would be equivalent to Adam

Re: GDC/LDC on Sparc Solaris

2014-03-24 Thread Nordlöw
On Sunday, 23 March 2014 at 22:00:23 UTC, andro wrote: On Tuesday, 18 March 2014 at 23:52:49 UTC, Nordlöw wrote: Does GDC and/or LDC have sparc solaris backend support? I'm trying to make my company use D and we have a bunch of legacy machines that unfortunately run on sparc-solaris 2.10.

Re: Function to print a diamond shape

2014-03-24 Thread monarch_dodra
On Sunday, 23 March 2014 at 18:28:18 UTC, Jay Norwood wrote: On Sunday, 23 March 2014 at 17:30:20 UTC, bearophile wrote: The task didn't ask for a computationally efficient solution :-) So you are measuring something that was not optimized for. So there's lot of variance. Bye, bearophile

Need help how to get started with D ranges

2014-03-24 Thread Uranuz
I see that ranges is primitive to organzie universal approach to write some algorithms. But I'm using algorithms from the library but I still can't start with writing my own algorithms based on ranges. For example I have the following function written without ranges. I want to improve it and

Re: Need help how to get started with D ranges

2014-03-24 Thread John Colvin
On Monday, 24 March 2014 at 12:13:43 UTC, Uranuz wrote: I see that ranges is primitive to organzie universal approach to write some algorithms. But I'm using algorithms from the library but I still can't start with writing my own algorithms based on ranges. For example I have the following

Re: Function to print a diamond shape

2014-03-24 Thread Jay Norwood
Very nice example. I'll test on ubuntu later. On windows ... D:\diamond\diamond\diamond\Releasediamond 1 nul brad: time: 19544[ms] printDiamond1: time: 1139[ms] printDiamond2: time: 1656[ms] printDiamond3: time: 663[ms] jay1: time: 455[ms] sergei: time: 11673[ms] jay2: time: 411[ms]

Re: How useful should inout be?

2014-03-24 Thread Steven Schveighoffer
On Sun, 23 Mar 2014 06:28:52 -0400, Infiltrator lt.infiltra...@gmail.com wrote: So, following on from monarchdodra's comment [0] in the bug tracker, how exactly should inout work? For example, should the following work? import

Re: Need help how to get started with D ranges

2014-03-24 Thread Uranuz
Have you read this: http://ddili.org/ders/d.en/ranges.html ? Yes I have read it. It's difficult to formulate the question in English bu I'l try. In this example I searching for special symbols '' and '='. So when symbol found I use *save* method of range to remember start of *name* or

Re: Need help how to get started with D ranges

2014-03-24 Thread Uranuz
I have another question. For example I have some range with input data (for example some array). I using method popFront() to iterate to next element. Then with property front I check element if it has some value. Then I *save* it. But how could I get position of this derived range in original

Re: Function to print a diamond shape

2014-03-24 Thread bearophile
On Thursday, 20 March 2014 at 21:25:03 UTC, Ali Çehreli wrote: This is a somewhat common little exercise: if you like similar puzzles, here is another: Write a program that expects a 10-by-10 matrix from standard input. The program should compute sum of each row and each column and print

Re: Need help how to get started with D ranges

2014-03-24 Thread monarch_dodra
On Monday, 24 March 2014 at 14:12:58 UTC, Uranuz wrote: Have you read this: http://ddili.org/ders/d.en/ranges.html ? Yes I have read it. It's difficult to formulate the question in English bu I'l try. In this example I searching for special symbols '' and '='. So when symbol found I use

Is there a standard way to parse hex strings into numbers?

2014-03-24 Thread Gary Willoughby
Is there a standard way to parse hex strings into numbers? I have the following returned as a string: 0xac036f90 Is there a standard way to parse this into a ulong or do you just roll your own?

Re: Is there a standard way to parse hex strings into numbers?

2014-03-24 Thread Brad Anderson
On Monday, 24 March 2014 at 16:30:37 UTC, Gary Willoughby wrote: Is there a standard way to parse hex strings into numbers? I have the following returned as a string: 0xac036f90 Is there a standard way to parse this into a ulong or do you just roll your own? To accepts a radix

How to hand in a closure variable

2014-03-24 Thread Bienlein
Hello, I have some piece of code that compiles and runs fine: void main(string[] args) { int a = 7; int delegate() dg = { return a + 3; }; auto result = dg(); writeln(result); } Now I want the closure (aka delegate) to have a closure variable: int a = 7;

Re: How to hand in a closure variable

2014-03-24 Thread Dicebot
On Monday, 24 March 2014 at 16:40:55 UTC, Bienlein wrote: Now I want the closure (aka delegate) to have a closure variable: int a = 7; int delegate(int) dg = { value = return value + a + 3; }; auto result = dg(123); Unhappily, the code above doesn't compile. Tried various things, looked for

Re: How to hand in a closure variable

2014-03-24 Thread Matej Nanut
Hello! You just missed the syntax a little. Instead of: int delegate(int) dg = { value = return value + a + 3; }; You can write auto dg = (int value) { return value + a + 3; }; // Omitted return type, but had to specify type of value. or auto dg = (int value) = value + a + 3; //

Re: Is there a standard way to parse hex strings into numbers?

2014-03-24 Thread Gary Willoughby
On Monday, 24 March 2014 at 16:35:42 UTC, Brad Anderson wrote: On Monday, 24 March 2014 at 16:30:37 UTC, Gary Willoughby wrote: Is there a standard way to parse hex strings into numbers? I have the following returned as a string: 0xac036f90 Is there a standard way to parse this

Re: Socket: Detect connection close

2014-03-24 Thread nrgyzer
On Monday, 24 March 2014 at 05:32:30 UTC, Vladimir Panteleev wrote: On Sunday, 23 March 2014 at 20:12:38 UTC, nrgyzer wrote: Hi guys, I'm experimenting with sockets and having trouble to detect when the remote side closes the connection. Here's my code: // Client: module client; import

Re: Function implemented outside the class

2014-03-24 Thread MarisaLovesUsAll
On Monday, 24 March 2014 at 01:34:22 UTC, Matej Nanut wrote: Hello! You can implement static functions that act like members, like so: --- void myFunc(MyClass c) { ... } --- Which you will be able to call like: --- auto c = new MyClass(); c.myFunc(); --- because of uniform function call

Re: Function implemented outside the class

2014-03-24 Thread Steven Schveighoffer
On Mon, 24 Mar 2014 16:02:25 -0400, MarisaLovesUsAll maru...@2ch.hk wrote: On Monday, 24 March 2014 at 01:34:22 UTC, Matej Nanut wrote: Hello! You can implement static functions that act like members, like so: --- void myFunc(MyClass c) { ... } --- Which you will be able to call like:

Re: CMake for D

2014-03-24 Thread Dragos Carp
Any alternatives?? I moved cmaked2 to github [1], updated and simplified the usage a little (system cmake patch not necessary anymore). You can give it a try. Dub registry support is also on the way. Regards Dragos [1] - https://github.com/dcarp/cmake-d

Re: CMake for D

2014-03-24 Thread Andrei Alexandrescu
On 3/24/14, 4:55 PM, Dragos Carp wrote: Any alternatives?? I moved cmaked2 to github [1], updated and simplified the usage a little (system cmake patch not necessary anymore). You can give it a try. Dub registry support is also on the way. Regards Dragos [1] -

Re: CMake for D

2014-03-24 Thread ed
On Monday, 24 March 2014 at 23:55:14 UTC, Dragos Carp wrote: Any alternatives?? I moved cmaked2 to github [1], updated and simplified the usage a little (system cmake patch not necessary anymore). You can give it a try. Dub registry support is also on the way. Regards Dragos [1] -

Re: CMake for D

2014-03-24 Thread Trent Forkert
On Monday, 24 March 2014 at 23:55:14 UTC, Dragos Carp wrote: Any alternatives?? I moved cmaked2 to github [1], updated and simplified the usage a little (system cmake patch not necessary anymore). You can give it a try. Dub registry support is also on the way. Regards Dragos [1] -

Re: Function to print a diamond shape

2014-03-24 Thread Jay Norwood
not through yet with the diamond. This one is a little faster. Appending the newline to the stars and calculating the slice backward from the end would save a w.put for the newlines ... probably faster. I keep looking for a way to create a dynamic array of a specific size, filled with the

Problems with OutputRanges

2014-03-24 Thread Meta
I'm not sure what I'm doing wrong... the following code prints nothing: void main() { import std.stdio, std.range; string str = asdf; auto sink = new dchar[](str.length); auto fun = (dchar c) { sink.put(c); }; foreach (dchar c; str) { fun(c); }

Re: Problems with OutputRanges

2014-03-24 Thread Ali Çehreli
On 03/24/2014 07:42 PM, Meta wrote: I'm not sure what I'm doing wrong... the following code prints nothing: void main() { import std.stdio, std.range; string str = asdf; auto sink = new dchar[](str.length); auto fun = (dchar c) { sink.put(c); }; foreach (dchar

Re: Function to print a diamond shape

2014-03-24 Thread Jay Norwood
These were times on ubuntu. I may have printed debug build times previously, but these are dmd release build. I gave up trying to figure out how to build ldc on ubuntu. The dmd one click installer is much appreciated. brad: time: 12425[ms] printDiamond1: time: 380[ms] printDiamond2: time: