Giter Club home page Giter Club logo

calculator's People

Contributors

joelniemela avatar

Stargazers

 avatar

Watchers

 avatar

calculator's Issues

Feature: Add explicit units

  • Implement the concept of "units":
    • Numbers without explicit units should have the unit unit.
    • When two numbers of different units are in an expression, the result should have the unit expected of that operation.
  • Add the button ° (degree). Add support to the parser for numbers such as 23° and 32.43°
    • A number that ends in ° has the unit degree

Feature: Add lambdas

Lambda functions should be added with the following syntax:

  • Define lambdas like fn : λx.x + 2.
  • Define multi-argument lambdas as fn : λx y.x + y
  • Call a lambda either by calling the variable it is bound to: fn(4)
  • or by calling it directly: (λx.x + 2)(2)

Feature: Add functionality to Rad/Deg button.

Currently, the Rad/Deg toggle doesn't affect the behavior of the trigonometry functions.

  • When Rad is set, trigonometry functions should treat their input as radians.
  • When Deg is set, trigonometry functions should treat their input as degrees.

Add the variable module

The variable module should contain a way to inspect variables' values and modify them. Buttons related to variables, such as :, currently in the function module, should be moved to the variable module.

Things to look out for:

  • Make sure that the variable inspector has enough screen space to display longer values, such as big numbers and complicated functions.
  • There should be a way to browse existing variables without taking up too much screen space. Maybe this could be a stacked layout, togglable with a button?
  • Constans could also be moved to the variable module. These might also need to be in a stacked layout to save on space, or they could use the bottom row of the variable-browser layout.

Feature: Add scoping

Calling a lambda should create a function scope, where arguments and any temporary variables are stored.

Make calculator layout modular

The calculator's layout should be modular and organized in 4x5 segments (modules), which can be combined in different ways. Stacking modules and toggling between them with a button should also be possible to save screen space.

Potential modules:

  • Base-module: contains the Numpad and basic arithmetic operators.
  • Function-module: contains built-in functions, the lambda button (λ), and other function-related buttons.
  • Variable-module: contains a variable-inspector where the user can inspect the variables' values and modify them. It also contains variable-related buttons, such as : for assigning variables.
  • Scope-module: contains a list where the user can select variables in the global scope and then view them in the variable-inspector.

Feature: Add Auto mode for Rad/Deg switch.

There should be an Auto mode which would allow the use of radians and degrees in the same equation.

Add the button ° (degree). Add support to the parser for numbers such as 23° and 32.43°

When Auto is enabled:

  • Any number that ends in ° should be treated as degrees.
  • Any number that doesn't end in ° should be treated as radians.

Make a Calculator class

Organize all calculator state and logic into a class that creates all necessary DOM elements and sets up event handlers when instantiated.

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.