# This PR introduces:
## Parsing arrays:
{1,2,3} and {1;2;3}
Note that array elements can be numbers, booleans and errors (#VALUE!)
## Evaluating arrays in the SUM function
=SUM({1,2,3}) works!
## Evaluating arithmetic operation with arrays
=SUM({1,2,3} * 8) or =SUM({1,2,3}+{2,4,5}) works
This is done with just one function (handle_arithmetic) for most operations
## Some mathematical functions implement arrays
=SUM(SIN({1,2,3})) works
This is done with macros. See fn_single_number
So that implementing new functions that supports array are easy
# Not done in this PR
## Most functions are not supporting arrays
When that happens we either through #N/IMPL! (not implemented error)
or do implicit intersection. Some functions will be rather trivial to "arraify" some will be hard
## The final result in a cell cannot be an array
The formula ={1,2,3} in a cell will result in #N/IMPL!
## Exporting arrays to Excel might not work correctly
Excel uses the cm (cell metadata) for formulas that contain dynamic arrays.
Although the present PR does not introduce dynamic arrays some formulas like =SUM(SIN({1,2,3}))
is considered a dynamic formula
## There are not a lot of tests in this delivery
The bulk of the tests will be added once we start going function by function# This PR introduces:
## Parsing arrays:
{1,2,3} and {1;2;3}
Note that array elements can be numbers, booleans and errors (#VALUE!)
## Evaluating arrays in the SUM function
=SUM({1,2,3}) works!
## Evaluating arithmetic operation with arrays
=SUM({1,2,3} * 8) or =SUM({1,2,3}+{2,4,5}) works
This is done with just one function (handle_arithmetic) for most operations
## Some mathematical functions implement arrays
=SUM(SIN({1,2,3})) works
This is done with macros. See fn_single_number
So that implementing new functions that supports array are easy
# Not done in this PR
## Most functions are not supporting arrays
When that happens we either through #N/IMPL! (not implemented error)
or do implicit intersection. Some functions will be rather trivial to "arraify" some will be hard
## The final result in a cell cannot be an array
The formula ={1,2,3} in a cell will result in #N/IMPL!
## Exporting arrays to Excel might not work correctly
Excel uses the cm (cell metadata) for formulas that contain dynamic arrays.
Although the present PR does not introduce dynamic arrays some formulas like =SUM(SIN({1,2,3}))
is considered a dynamic formula
## There are not a lot of tests in this delivery
The bulk of the tests will be added once we start going function by function
## The array parsing does not respect the locale
Locales that use ',' as a decimal separator need to use something different for arrays
## The might introduce a small performance penalty
We haven't been benchmarking, and having closures for every arithmetic operation and every function
evaluation will introduce a performance hit. Fixing that in he future is not so hard writing tailored
code for the operation
65 lines
1.3 KiB
Rust
65 lines
1.3 KiB
Rust
//! # IronCalcBase engine API
|
|
//!
|
|
//! This is the documentation for the base engine API.
|
|
//!
|
|
//! # Basic usage
|
|
//!
|
|
//! Add the dependency in Cargo.toml:
|
|
//!
|
|
//! ```toml
|
|
//! [dependencies]
|
|
//! ironcalc_base = { git = "https://github.com/ironcalc/IronCalc" }
|
|
//! ```
|
|
//!
|
|
//! <small> until version 0.5.0 you should use the git dependencies as stated </small>
|
|
//!
|
|
//! In this example we use the excel function `CONCAT` to concatenate strings in cells `A1` and `B1`:
|
|
//!
|
|
//! ```rust
|
|
#![doc = include_str!("../examples/hello_world.rs")]
|
|
//! ```
|
|
//!
|
|
//! In this example, we demonstrate our ability to handle formulas and errors:
|
|
//!
|
|
//! ```rust
|
|
#![doc = include_str!("../examples/formulas_and_errors.rs")]
|
|
//! ```
|
|
|
|
#![warn(clippy::print_stdout)]
|
|
|
|
pub mod calc_result;
|
|
pub mod cell;
|
|
pub mod expressions;
|
|
pub mod formatter;
|
|
pub mod language;
|
|
pub mod locale;
|
|
pub mod new_empty;
|
|
pub mod number_format;
|
|
pub mod types;
|
|
pub mod worksheet;
|
|
|
|
mod actions;
|
|
mod arithmetic;
|
|
mod cast;
|
|
mod constants;
|
|
mod functions;
|
|
mod implicit_intersection;
|
|
mod model;
|
|
mod styles;
|
|
mod units;
|
|
mod user_model;
|
|
mod utils;
|
|
mod workbook;
|
|
|
|
#[cfg(test)]
|
|
mod test;
|
|
|
|
#[cfg(test)]
|
|
pub mod mock_time;
|
|
|
|
pub use model::get_milliseconds_since_epoch;
|
|
pub use model::Model;
|
|
pub use user_model::BorderArea;
|
|
pub use user_model::ClipboardData;
|
|
pub use user_model::UserModel;
|