digitalmars.D.learn - Collections in D
- Roguish (3/3) Jan 13 2021 I can't find anything about collections in D. All I have found
- Ferhat =?UTF-8?B?S3VydHVsbXXFnw==?= (7/10) Jan 13 2021 You can refer to the docs for them:
- Roguish (8/11) Jan 13 2021 It seems collections are called "containers" in D's standard
- evilrat (6/7) Jan 13 2021 There is no specific set container, they just implemented as
- Roguish (2/4) Jan 13 2021 I see. Thanks for pointing that out.
- Ferhat =?UTF-8?B?S3VydHVsbXXFnw==?= (5/16) Jan 13 2021 I read many posts that rbtree can be a replacement for sets in
- Roguish (3/6) Jan 13 2021 Thanks, will read up.
- mw (6/8) Jan 13 2021 You can also search https://code.dlang.org
I can't find anything about collections in D. All I have found are arrays and maps ("associative arrays"). What about lists and sets? What if I just want a linked list?
Jan 13 2021
On Wednesday, 13 January 2021 at 11:58:11 UTC, Roguish wrote:I can't find anything about collections in D. All I have found are arrays and maps ("associative arrays"). What about lists and sets? What if I just want a linked list?You can refer to the docs for them: https://dlang.org/phobos/std_container.html https://dlang.org/phobos/std_container_slist.html https://dlang.org/phobos/std_container_dlist.html For sets see: https://forum.dlang.org/thread/vqyxqkcszqfwpgqtjgcm forum.dlang.org
Jan 13 2021
On Wednesday, 13 January 2021 at 11:58:11 UTC, Roguish wrote:I can't find anything about collections in D. All I have found are arrays and maps ("associative arrays"). What about lists and sets? What if I just want a linked list?It seems collections are called "containers" in D's standard library, which explains why I didn't find anything searching for "collections". As concerns linked lists, I have found https://dlang.org/phobos/std_container_dlist.html which seems perfectly adequate. What about sets?
Jan 13 2021
On Wednesday, 13 January 2021 at 12:06:05 UTC, Roguish wrote:What about sets?There is no specific set container, they just implemented as generic algorithms over the ranges. There is a section for set operations (std.algorithm.setops module). https://dlang.org/phobos/std_algorithm.html
Jan 13 2021
On Wednesday, 13 January 2021 at 12:39:50 UTC, evilrat wrote:There is no specific set container, they just implemented as generic algorithms over the ranges.I see. Thanks for pointing that out.
Jan 13 2021
On Wednesday, 13 January 2021 at 12:06:05 UTC, Roguish wrote:On Wednesday, 13 January 2021 at 11:58:11 UTC, Roguish wrote:I read many posts that rbtree can be a replacement for sets in dlang. see its behaviour is identical. https://dlang.org/phobos/std_container_rbtree.htmlI can't find anything about collections in D. All I have found are arrays and maps ("associative arrays"). What about lists and sets? What if I just want a linked list?It seems collections are called "containers" in D's standard library, which explains why I didn't find anything searching for "collections". As concerns linked lists, I have found https://dlang.org/phobos/std_container_dlist.html which seems perfectly adequate. What about sets?
Jan 13 2021
On Wednesday, 13 January 2021 at 12:48:47 UTC, Ferhat Kurtulmuş wrote:I read many posts that rbtree can be a replacement for sets in dlang. see its behaviour is identical.Thanks, will read up.
Jan 13 2021
On Wednesday, 13 January 2021 at 12:06:05 UTC, Roguish wrote:which seems perfectly adequate. What about sets?You can also search https://code.dlang.org I use: https://code.dlang.org/packages/emsi_containers Which has hashset: https://github.com/dlang-community/containers/blob/fc1625a5a0c253272b80addfb4107928495fd647/src/containers/hashset.d
Jan 13 2021