Data structures and algorithms in D?

Russel Winder russel at winder.org.uk
Mon Oct 8 13:47:44 UTC 2018


On Mon, 2018-10-08 at 11:12 +0000, bauss via Digitalmars-d-learn wrote:
> On Monday, 8 October 2018 at 06:15:46 UTC, eastanon wrote:
> > On Monday, 8 October 2018 at 05:18:35 UTC, bauss wrote:
> > > On Sunday, 7 October 2018 at 20:27:47 UTC, eastanon wrote:
> > > > Are there reading resources on Data structures and Algorithms 
> > > > in D? There are several such books in the C/C++ and Java 
> > > > world and many senior/experienced D users might have come 
> > > > across them in C. But for people who join D after reading 
> > > > Ali's book, a data structures and algorithms book in D would 
> > > > be a great next step. i.e. a book that uses D's idioms and 
> > > > best practices. Any such material in development or 
> > > > recommended blog posts?
> > > 
> > > http://ddili.org/ders/d.en/index.html
> > > 
> > > Pretty sure it also covers stuff like that.
> > 
> > But this is a great introductory book it is not a dedicated 
> > text on algorithms and data structures. Have you read it?
> 
> I don't think there are any specific on data structures and 
> algorithm only, most books seem to be generic.

Is there actually a need for such a book?

All books labelled "Algorithms and Data Structures" or "Data Structures and
Algorithms" and especially those with "Using <X>" in the title for some
programming language X, are invariably textbooks designed for use in
university courses – usually follow on courses from introductory programming
if an X is mentioned. Given the current use of programming languages in
universities, X is drawn from {Java, Python}. C++ used to be in the set but I
suspect no longer. I cannot imagine D will get into that set any time soon,
though it would be nice if it did.

All to often the code in the textbooks is a we bit second rate. :-(

The purpose of these books is for students to learn the academic material, not
the creation of production libraries. Most programming language libraries have
all the algorithms coded up in the libraries. And for those algorithms that
are not, this level of textbook is rarely going to be the right tool to help
the coding.

The real question is then, does Phobos have all the right algorithms and data
structures in it. It has Red-Black Tree, but I suspect not B-Tree, B+-Tree, or
B*-Tree. Is this an issue?

I see that Go and Rust are basically in the same boat, but they have:

https://www.golangprograms.com/data-structure-and-algorithms.html

https://github.com/EbTech/rust-algorithms

respectively. Doing something similar for D might be worthwhile.

Also of course D stuff perhaps needn't be in Phobos. Rust has crates, D has
Dub. Very little problem starting an A&DS package for D for production
purposes without having to bother with getting stuff into Phobos.

-- 
Russel.
===========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20181008/8e30a424/attachment.sig>


More information about the Digitalmars-d-learn mailing list