Skip to content

rwxrob/structs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Data Structs with Go (1.18 ) Generics

Go Version GoDoc License Go Report Card

Go report card has no idea how to handle Go 1.18. 😀

All structures make judicious use of generics and implement the same json.AsJSON interface (and others) making them much more consumable and shareable.

Design Decisions

  • Why no linked-list or queue? Because they are fulfilled by QStack and Node.

  • Decided to drop async walks of Node. It's easily accomplished by enclosing whatever channel is needed in the iterator function and forking a goroutine off from within it.

  • Don't stutter. tree.Tree was changed to tree.E and qstack.QStack was changed to qstack.QS to follow the idiomatic "don't stutter" design preferred by core Go libraries like testing.T. (We don't want to be another context.Context.)

TODO

  • Add equivalent methods to Node from JavaScript (InsertAfter, etc.)
  • Add Union and other set methods