GithubHelp home page GithubHelp logo

Comments (7)

kevinbarabash avatar kevinbarabash commented on July 24, 2024 1

Even in the case of (2 + 3) + (x + y) there won't be any Parenthesis nodes, b/c it parses to:

( + ( + 2 3 ) ( + x y ) )

The only time we should need a Parenthesis node is if we want to show x + (0) = (1) in:

x + 3 = 4 => x + (3 - 3) = (4 - 3) => x + (0) = (1) => x + 0 = 1 => x = 1

from mathsteps.

hmaurer avatar hmaurer commented on July 24, 2024

When are new parens generated? I don't quite get this.

from mathsteps.

evykassirer avatar evykassirer commented on July 24, 2024

there aren't new parens, but rather sometimes parens stop being helpful

e.g. (2 + 3) * 10 => 5 * 10, not (5) * 10

so we get rid of parens that aren't necessary anymore after each step

does that make sense?

from mathsteps.

kevinbarabash avatar kevinbarabash commented on July 24, 2024

math-parser parses (2 + 3) * 10 to ( '*' ( '+' 2 3 ) 10 ) which has no parens in the AST. The parens should only show up when necessary when rendering to a string or to TeX. It looks like we're creating parens in a lot of places we probably shouldn't be.

from mathsteps.

evykassirer avatar evykassirer commented on July 24, 2024

oh, yeah the tree without as mnay parens and better printing function will make it way easier to not worry about parenthesis sweeet

though sometimes we'll still want them for pedagogical reasons (e.g. (2 + 3) + (x + y) to show grouping)

from mathsteps.

evykassirer avatar evykassirer commented on July 24, 2024

I'm wondering if we'd ever need to reflatten the tree midway through the step by step solution, or if we can get by with the original structure of the tree and the manipulations along the way

from mathsteps.

kevinbarabash avatar kevinbarabash commented on July 24, 2024

A Parenthesis node is also necessary if we wanted to show

x + (3 - 3) = (4 - 3)

instead of

x + (3 - 3) = 4 - 3

from mathsteps.

Related Issues (20)

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.