www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Data structures and algorithms in D?

reply eastanon <biorelated gmail.com> writes:
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?
Oct 07 2018
next sibling parent reply bauss <jj_1337 live.dk> writes:
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.
Oct 07 2018
parent reply eastanon <biorelated gmail.com> writes:
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?
Oct 07 2018
parent reply bauss <jj_1337 live.dk> writes:
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.
Oct 08 2018
parent reply Russel Winder <russel winder.org.uk> writes:
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=20
 in D? There are several such books in the C/C++ and Java=20
 world and many senior/experienced D users might have come=20
 across them in C. But for people who join D after reading=20
 Ali's book, a data structures and algorithms book in D would=20
 be a great next step. i.e. a book that uses D's idioms and=20
 best practices. Any such material in development or=20
 recommended blog posts?
=20 http://ddili.org/ders/d.en/index.html =20 Pretty sure it also covers stuff like that.
=20 But this is a great introductory book it is not a dedicated=20 text on algorithms and data structures. Have you read it?
=20 I don't think there are any specific on data structures and=20 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 =E2=80=93 usually follow on courses from introductory pr= ogramming 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 h= ave 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 hel= p the coding. The real question is then, does Phobos have all the right algorithms and da= ta 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. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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
Oct 08 2018
parent eastanon <biorelated gmail.com> writes:
On Monday, 8 October 2018 at 13:47:44 UTC, Russel Winder wrote:
 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.
Thank you Russel. I think it would be very worthwhile for D. For experienced developers it might not be an issue, but as you highlight, for anyone who is learning or taking an algorithms course such a resource would be useful. Borrowing from the rust-algorithms readme, this would be for: 1. Students and educators 2. Potentially for D programming advocacy 3. Serve as a quick reference for implementing basic algorithms and ideally improve on the same.
Oct 08 2018
prev sibling next sibling parent ShadoLight <ettienne.gilbert gmail.com> writes:
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?
AFAIK there is no specific book that focuses and delves into Data structures and Algorithms specifically, however there are some books (besides Ali's) that touches on it - at least in a limited sense specific to the topics in each book. For example, Adam D. Ruppe's 'D Cookbook' has a chapter on Ranges, which also covers using ranges when implementing/using algorithms. Likewise Michael Parker's 'Learning D' book has 2 chapters that touches on Ranges and Algorithms: - Chapter 6: Understanding Ranges - Chapter 7: Composing Functional Pipelines with Algorithms and Ranges I'm not sure about Andrei's TDPL book - I read it so long ago I cannot remember. (And I don't have my copy with me so I cannot check). And Kai Nacke's 'D Web Development' book does not really cover these topics either. Of the above-mentioned 2 books (that do cover it), I think Michael's book is the better resource at the moment (that I am aware of anyway). But I'm not sure if I will claim that it covers these topics better than Ali's book at the moment - so maybe it is not going to be good enough for you either. Ali's book anyway seems to be regularly updated (since he self-publishes it) to be up-to-date with the latest in the D language/ecosystem, so I think we will see any new info on this in Ali's book before any other book manages to bring out a new edition (the other books just regularly published - so are in effect really snapshots of the language at the time of publication). Of course, this is besides the problem that containers are (still!) somewhat lacking in D compared to other languages - you just need to look at [1] to see that. [1] https://dlang.org/phobos/std_container.html
Oct 08 2018
prev sibling parent Alex <sascha.orlov gmail.com> writes:
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?
Data structures and algorithms are somewhat abstract from the language, I think. See e.g., Introduction to Algorithms; Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest Nevertheless, some references of applications are already mentioned above. The books are very cool, by the way. There are also some online references, which are not mentioned yet e.g., https://p0nce.github.io/d-idioms/ http://rosettacode.org/wiki/Category:D The standard library itself: https://github.com/dlang/phobos And the package library build by enthusiasts at https://code.dlang.org And last but not least, this forum. Many ideas emerge here from the collaborative work of experts from different areas. They are ready to assist in many questions at any time of the day.
Oct 08 2018