I have been translating my Turkish D book "D Programlama Dili" to
English under the title "Programming in D". I have decided to make its
current state available online:
http://ddili.org/ders/d.en/index.html
I will make more chapters available as they get translated.
As the book is for the n
On 2011/11/14 02:10 AM, bearophile wrote:
SimonM:
2009, 27 April:
http://www.digitalmars.com/d/archives/digitalmars/D/std.algorithm.BinaryHeap_88811.html
See the working version:
http://rosettacode.org/wiki/Huffman_coding#D
Bye,
bearophile
Okay, I looked at the example, and it seems that t
On 2011/11/14 01:55 AM, Jonathan M Davis wrote:
On Monday, November 14, 2011 01:25:58 SimonM wrote:
What am I doing wrong?
I don't know. I've never used BinaryHeap. I'd have to study it. I just noticed
that you were trying to use treat Array as a range, which isn't going to work
(regardless of
On Monday, November 14, 2011 04:03:54 so wrote:
> Trying to remember the discussions on digitalmars.D regarding
> enum/immutable. There were contradicting opinions.
> You ask the same question at two different times, you get at least two
> different answers, especially on this matter.
> There was/i
On Mon, 14 Nov 2011 02:50:50 +0200, Jonathan M Davis
wrote:
No. Those are two _very_ different things.
immutable a = [3, 1, 2];
creates a variable of type immutable(int[]). You takes up memory. You
can take
its address - e.g. &a. It exists even if you don't use it at all.
enum a = [3, 1
On Monday, November 14, 2011 02:16:57 so wrote:
> On Mon, 14 Nov 2011 02:09:40 +0200, Jonathan M Davis
>
> wrote:
> > It depends entirely on what you're trying to do. If you understand how
> > manifest constants work, then they can be quite advantageous. What you
> > probably really want for arra
On Mon, 14 Nov 2011 02:09:40 +0200, Jonathan M Davis
wrote:
It depends entirely on what you're trying to do. If you understand how
manifest constants work, then they can be quite advantageous. What you
probably really want for arrays though is not an enum but just a const or
immutable module
SimonM:
> 2009, 27 April:
> http://www.digitalmars.com/d/archives/digitalmars/D/std.algorithm.BinaryHeap_88811.html
See the working version:
http://rosettacode.org/wiki/Huffman_coding#D
Bye,
bearophile
On Sunday, November 13, 2011 19:02:01 bearophile wrote:
> Jonathan M Davis:
> > > import std.algorithm;
> > > void main() {
> > >
> > > enum a = [3, 1, 2];
> > > enum s = sort(a);
> > > assert(equal(a, [3, 1, 2]));
> > > assert(equal(s, [1, 2, 3]));
> > >
> > > }
> >
> > It's not
Jonathan M Davis:
> > import std.algorithm;
> > void main() {
> > enum a = [3, 1, 2];
> > enum s = sort(a);
> > assert(equal(a, [3, 1, 2]));
> > assert(equal(s, [1, 2, 3]));
> > }
>
> It's not a bug. Those an manifest constants. They're copy-pasted into
> whatever
> code you use
On Monday, November 14, 2011 01:25:58 SimonM wrote:
> What am I doing wrong?
I don't know. I've never used BinaryHeap. I'd have to study it. I just noticed
that you were trying to use treat Array as a range, which isn't going to work
(regardless of whatever BinaryHeap does), so I tried to help y
On 2011/11/13 23:22 PM, Jonathan M Davis wrote:
On Sunday, November 13, 2011 23:12:30 SimonM wrote:
Okay, I might on the wrong track, but part of the reason that the
isRandomAccessRange template fails might be because, while Array!(T)
internally uses a Range, it doesn't itself actually provide t
On Sunday, November 13, 2011 17:54:14 bearophile wrote:
> Do you remember if this bug is in Bugzilla?
>
>
> import std.algorithm;
> void main() {
> enum a = [3, 1, 2];
> enum s = sort(a);
> assert(equal(a, [3, 1, 2]));
> assert(equal(s, [1, 2, 3]));
> }
It's not a bug. Those an m
Do you remember if this bug is in Bugzilla?
import std.algorithm;
void main() {
enum a = [3, 1, 2];
enum s = sort(a);
assert(equal(a, [3, 1, 2]));
assert(equal(s, [1, 2, 3]));
}
Bye,
bearophile
On Sunday, November 13, 2011 23:12:30 SimonM wrote:
> Okay, I might on the wrong track, but part of the reason that the
> isRandomAccessRange template fails might be because, while Array!(T)
> internally uses a Range, it doesn't itself actually provide the save()
> and popBack() functions that a Ra
On 2011/11/13 22:49 PM, SimonM wrote:
Hey, I'm trying to use the BinaryHeap in Phobos, but somehow can't get
it working with the Array!(T) container so that the heap can actually be
growable. I keep getting this error:
Error: template instance BinaryHeap!(myArray,"a > b") does not match
template
Hey, I'm trying to use the BinaryHeap in Phobos, but somehow can't get
it working with the Array!(T) container so that the heap can actually be
growable. I keep getting this error:
Error: template instance BinaryHeap!(myArray,"a > b") does not match
template declaration BinaryHeap(Store,alias
17 matches
Mail list logo