Code Monkey home page Code Monkey logo

spreadsheet's Introduction

spreadsheet is a C++ library that enables "spreadsheet-programming", i.e., setting up variables ('cells') where each cell is assigned an expression that can contain the values of other cells. Changes are propagated to all dependent cells, as in a spreadsheet.

You create a new cell as follows:

    Cell<double> a = sheet.NewCell<double>("a");

And you assign an expression to a cell as follows:

    Cell<double> a = sheet.NewCell<double>("a");
    Cell<double> b = sheet.NewCell<double>("b");

    a.Set( SQRT(2 * b()) );
    b.Set(18.3);

You get the current value of a cell with:

    a.Value()

See main.cpp for a complete program with a simple usage example. 

Spreadsheet was developed to demonstrate the use of streamulus. There are currently a few limitations, which will be removed if there is interest in this library for its own sake:

* Cyclic dependencies are not detected. You will be rewarded with the infinite loop you deserve. 
* Note that in the code above, we needed to write "b()" in the expression assigned to a, rather than just "b". This is unfortunate, and with some proto-trickery can be fixed. 

See also:

Blog post at http://streamulus.blogspot.co.uk/2012/08/spreadsheet-programming-in-c.html

Building:

spreadsheet is a header-only library. It uses boost and streamulus. So put these three libraries in your include path. That's all.

spreadsheet's People

Contributors

iritkatriel avatar

Stargazers

Romel avatar Creator avatar Magnus Jurdal avatar caozhanhao avatar Kobi Kai Calev avatar David Emmanuel Katz avatar Ali Ashkani Nia avatar  avatar matias avatar STYLIANOS IORDANIS avatar David Landa avatar  avatar Aman Kumar avatar Dmitry Ledentsov avatar  avatar

Watchers

Abhinav Raghunandan avatar James Cloos avatar  avatar  avatar Magnus Jurdal avatar

spreadsheet's Issues

Detect cycles

in Cell::Set(), check first if the new expression would create a cycle. Do not set if so.

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.