Code Monkey home page Code Monkey logo

dialect.rs's People

Contributors

rapodaca avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

dialect.rs's Issues

`graph` submodule

The Working with Graphs section of the MS points to a few problems and solutions for the interconversion of trees and graphs. It would be very useful for the RI to implement these solutions, thus saving the user the trouble of doing it themselves.

Items include:

Transformation may or may not be better placed in their own submodule.

Remove tree/Error

Its only variant is range and it has nothing to do with trees.

Replace the return type of those features using Result with Option.

Does `Follower#pop` really need a parameter?

Removing this parameter would simplify the implementation of Followers. On the other hand, going this way could require additional work by clients who would need to mark the start of branches somehow.

Rename data structures

Start with child.rs, which should become edge.rs:

pub enum Edge {
    Bond(Bond),
    Split(Atom)
}

The rest should follow from this.

Tree as the central abstraction

The current central abstraction is Atom, a node in a molecular graph. The problem is that Dialect doesn't work directly with graphs, just trees. This is why strange artifacts like index pop up and can lead to invalid state. The current type are mismatched with the underlying problem that Dialect solves.

Atom should remain the central abstraction, but from the perspective of a molecular tree. In other words, the main types should look like this:

pub struct Atom {
    pub kind: AtomKind,
    pub children: Vec<Child>
}

pub enum Child {
    Union(BondKind, Terminal),
    Split(Atom)
}

pub enum Terminal {
    Atom(Atom),
    Cut(Cut)
}

walk performs a depth-first traversal over a root atom:

pub fn walk(root: &Atom, follower: &mut dyn Follower) -> Result<(), Error> {
    todo!()
}

A Builder implements Follower to build a tree, returning its root:

pub struct Builder { }

impl Follower for Builder {
    // todo
}

impl Builder {
    pub fn build(self) -> Atom {
        todo!()
    }
}

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.