Git Product home page Git Product logo

structs's Introduction

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

structs's People

Contributors

rwxrob avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

structs's Issues

Create StrictNodes by default

By default a tree/node should not allow setting of any value if there is
at least one child node. There are "edges" and "nodes" not both even
though they can both be contained in the same Node struct type.

Add Marshal/Unmarshal for Tree

Now that we have Node and Tree we can give Tree a long and short form of
marshaling to JSON and leave Node to just the compact form.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.