Any other core packages like containers (heap/ring/list)?

Hi all,

I’ve recently read the code of the containr/heap, container/ring & container/list packages. Very usefull and they ship together with the go source code.

Are there any other such data structures whose implementation can be found (and used) in the core golang source code ?

I am more interested in the go soruce code, not custom made packages with data structures/algorithms I can import from the internet.

No, there are no other package like that in the standard library.

Note that these are not data structures. They are just algorithms applied on a user provided data structure.
The user data structure needs to provide primitive functions modifying the user data structure.

Hi @Christophe_Meessen,

Thx for your quick reply. I understand that the ring/list/heap packages are somewhere in between data structures and algorithms, perhaps closer to algorithms than data structures. I still call them data structures on account that they model the abstract data structures with the same name.

Is there any reason why, in the standard library, we do not find more of these ? Seems a bit strange. I mean why did they put these, but not more.

I guess it’s because these are the most frequently needed, and perhaps also because the Go team needed them for the compiler or runtime code like the GC.

Also, they have since become considered a bad idea for several reasons (linked lists considered harmful for cache locality, interface{}-typed containers likewise).

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.