Re: quickSort

2011-09-13 Thread Jonathan M Davis
On Wednesday, September 14, 2011 05:43:37 %u wrote: > i have qustion why filter can't return int[] > and if lambda return the last Expression without return keyword it would > much cleaner filter can't return int[]. filter does not alter the original array. It returns a new range with only the e

Re: quickSort

2011-09-13 Thread %u
i have qustion why filter can't return int[] and if lambda return the last Expression without return keyword it would much cleaner

Re: CLI library?

2011-09-13 Thread Jesse Phillips
On Tue, 13 Sep 2011 10:59:27 +0300, Dainius (GreatEmerald) wrote: > Is there any library that would allow me to use the extended terminal > features (like coloured backgrounds and custom/multiple resolution > support) that works with D and is not platform-dependent? Something > similar to ncurses?

Re: quickSort

2011-09-13 Thread Timon Gehr
On 09/14/2011 04:12 AM, Timon Gehr wrote: On 09/14/2011 03:34 AM, hdsh wrote: this my try int[] quickSort(int[] arr) { int[] result = quickSort(filter!(arr< arr[0])(arr)) ~ arr[0] ~ quickSort(filter!(arr> arr[0])(arr)); } but it fail to compile Note that this approach is an inefficient way o

Re: quickSort

2011-09-13 Thread Timon Gehr
On 09/14/2011 03:34 AM, hdsh wrote: this my try int[] quickSort(int[] arr) { int[] result = quickSort(filter!(arr< arr[0])(arr)) ~ arr[0] ~ quickSort(filter!(arr> arr[0])(arr)); } but it fail to compile Note that this approach is an inefficient way of implementing a sorting routine.

Re: quickSort

2011-09-13 Thread Jonathan M Davis
On Wednesday, September 14, 2011 01:34:34 hdsh wrote: > this my try > > int[] quickSort(int[] arr) { > int[] result = quickSort(filter!(arr < arr[0])(arr)) ~ arr[0] ~ > quickSort(filter!(arr > arr[0])(arr)); > } > > but it fail to compile filter does not return an array. It returns a new ran

quickSort

2011-09-13 Thread hdsh
this my try int[] quickSort(int[] arr) { int[] result = quickSort(filter!(arr < arr[0])(arr)) ~ arr[0] ~ quickSort(filter!(arr > arr[0])(arr)); } but it fail to compile

Re: Is this a bug?

2011-09-13 Thread Jonathan M Davis
On Tuesday, September 13, 2011 15:34 Caligo wrote: > On Tue, Sep 13, 2011 at 4:47 AM, Jonathan M Davis wrote: > > On Monday, September 12, 2011 23:15:19 Caligo wrote: > > > On Mon, Sep 12, 2011 at 10:44 PM, Jonathan M Davis > > > > wrote: > > > > On Monday, September 12, 2011 22:38:25 Caligo wrot

Re: Is this a bug?

2011-09-13 Thread Caligo
On Tue, Sep 13, 2011 at 4:47 AM, Jonathan M Davis wrote: > On Monday, September 12, 2011 23:15:19 Caligo wrote: > > On Mon, Sep 12, 2011 at 10:44 PM, Jonathan M Davis > wrote: > > > On Monday, September 12, 2011 22:38:25 Caligo wrote: > > > > Great. So is it a known bug? > > > > > > I don't know.

Re: CLI library?

2011-09-13 Thread Aaron P
On 09/13/2011 02:59 AM, Dainius (GreatEmerald) wrote: Is there any library that would allow me to use the extended terminal features (like coloured backgrounds and custom/multiple resolution support) that works with D and is not platform-dependent? Something similar to ncurses? I know that there

Re: Converting Duration to TickDuration

2011-09-13 Thread Jonathan M Davis
On Tuesday, September 13, 2011 15:45:27 Vladimir Panteleev wrote: > On Tue, 13 Sep 2011 06:27:44 +0300, Jonathan M Davis > > wrote: > > Personally, I'd just Duration far those and not TickDuration. Duration > > is just > > as precise (if not more precise) than TickDuration as long as the system >

Re: A question about purity

2011-09-13 Thread Jonathan M Davis
On Tuesday, September 13, 2011 07:43:55 bearophile wrote: > Jonathan M Davis: > > However, Foo.y is not encapsulated > > by a strongly pure function at all. Other functions can alter alter it. > > So, it breaks purity. > > Thank you for your explanation :-) > > So, let's change the situation a bi

Re: A question about purity

2011-09-13 Thread Kagamin
bearophile Wrote: > So, let's change the situation a bit. If the struct Foo is the only thing > present in a module (to avoid someone to touch its private members), and the > y field is "private static" only foo2 is able to touch it. In this case isn't > foo2 weakly pure? Weakly pure function

Re: A question about purity

2011-09-13 Thread Christophe
bearophile , dans le message (digitalmars.D.learn:29490), a écrit : > Jonathan M Davis: > >> However, Foo.y is not encapsulated >> by a strongly pure function at all. Other functions can alter alter it. So, >> it >> breaks purity. > > Thank you for your explanation :-) > > So, let's change th

Re: Converting Duration to TickDuration

2011-09-13 Thread Vladimir Panteleev
On Tue, 13 Sep 2011 06:27:44 +0300, Jonathan M Davis wrote: Personally, I'd just Duration far those and not TickDuration. Duration is just as precise (if not more precise) than TickDuration as long as the system ticks aren't less than 1 hnsec apart. TickDuration is useful in that it gives

Re: A question about purity

2011-09-13 Thread bearophile
Jonathan M Davis: > However, Foo.y is not encapsulated > by a strongly pure function at all. Other functions can alter alter it. So, > it > breaks purity. Thank you for your explanation :-) So, let's change the situation a bit. If the struct Foo is the only thing present in a module (to avoi

Re: Is this a bug?

2011-09-13 Thread Jonathan M Davis
On Monday, September 12, 2011 23:15:19 Caligo wrote: > On Mon, Sep 12, 2011 at 10:44 PM, Jonathan M Davis wrote: > > On Monday, September 12, 2011 22:38:25 Caligo wrote: > > > Great. So is it a known bug? > > > > I don't know. You'd have to search bugzilla: d.puremagic.com/issues > > > > - Jonat

CLI library?

2011-09-13 Thread Dainius (GreatEmerald)
Is there any library that would allow me to use the extended terminal features (like coloured backgrounds and custom/multiple resolution support) that works with D and is not platform-dependent? Something similar to ncurses? I know that there was a dcurses project, but it seems that it only works w