Updated readme
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Joe Bellus 2022-10-16 21:40:11 -04:00
parent 0816ee49fc
commit 357cbd4b05
3 changed files with 111 additions and 4 deletions

View File

@ -6,9 +6,9 @@ Abacus is a lightweight scratch pad for making quick calculations. It is program
The following prebuilt binaries are provided:
[[https://objects.5sigma.io/public/abacus/abacus-linux-amd64.tar.gz][amd64 Linux Binary]] (tar.gz)
[[https://objects.5sigma.io/public/abacus/abacus.exe][Windows Executable]] (exe)
[[https://objects.5sigma.io/public/abacus/abacus-amd64.deb][Linux Debian Package]] (.deb)
- [[https://objects.5sigma.io/public/abacus/abacus-linux-amd64.tar.gz][amd64 Linux Binary]] (tar.gz)
- [[https://objects.5sigma.io/public/abacus/abacus.exe][Windows Executable]] (exe)
- [[https://objects.5sigma.io/public/abacus/abacus-amd64.deb][Linux Debian Package]] (.deb)
[[abacus_demo.png]]

107
abacus-core/README.org Normal file
View File

@ -0,0 +1,107 @@
* Abacus Core
Abacus core provides the scripting and calculation engine for [[../][Abacus]].
For General information visit [[../][Abacus]]
For information on the UI application visit [[abacus-ui/][Abacus UI]].
* Scripting
** Everything is an expression
Everything can be evaulated as an experession. This means variables can be set to if blocks, loops, or anything else;
#+begin_src rust
let x = if y == "test" { 1 } else { 2 };
#+end_src
** Returning output
Output is rendered based on the returned value of a block. The final value of the block is automatically returned. The return keyword is only needed if an early return is preferable.
#+begin_src rust
if x == 0 {
return 0;
}
if x > 10 {
// note the lack of a semicolon here
x / 5
} else {
// note the lack of a semicolon here
x / 10
}
#+end_src
** Variables
Variables can be assigned using the let keyword. Variables are dynamically typed and globally mutable:
#+begin_src rust
let pulse_rate = 0.8;
let time = 3.2;
time / pulse_rate
#+end_src
** Functions
Functions can be defined using the fn keyword. Return types and arguments are dynamic and do not require typing.
#+begin_src rust
fn add_one(x) {
x + 1;
}
add_one(2)
#+end_src
** Object maps
Dictionary style data maps are possible and can be index or accessed by a property notation. Dictionaries are defined using a special syntax wrapper: #{}.
#+begin_src rust
let account = #{ first_name: "Alice", last_name: "Allison", balance: 150.32 };
// Access via property notation
account.balance += 10;
// Access via indexing
account["last_name"] = "Test";
account
#+end_src
** Series
A series provides a powerful way to perform calculations on an array of data. Operations performedon the series are performed against all of its member values. Serieses are constructed using the series fucntion and passing an array of values.
#+begin_src rust
let s = series([1,2,3,4]);
// Return an array of values calculated from the series
[ s + 10, s * s ]
#+end_src
** Dataframes
Dataframes provide an object for working with tabular data made up of several series. Dataframes are initialzied using the dataframe constructor function and passing in an object map container name/array pairs.
Dataframe series can be accessed via indexing or property notation just like object maps.
#+begin_src rust
let df = dataframe(#{
name: ["Alice", "Bob", "Charles"],
rate: [18,20,20],
hours: [22,40,55]
});
df.balance = df.rate * df.hours;
df
#+end_src
*** Filtering
Dataframes are more powerful than object maps and can be filtered. Filtering requires two parts:
1. Selecting the columns to be included
2. providing a predicate to filter a column's value
The filtering syntax is FROM <dataframe> <column array> : <array of predicates>
Predicates consist of a quoted name for the series/column an operator and a value. Valid operators are: gt, gte, lt, lte.
Filtering returns a new dataframe with the extracted values.
#+begin_src rust
let df = dataframe(#{
name: ["Alice", "Bob", "Charles"],
rate: [18,20,20],
hours: [22,40,55]
});
let high_rates = from df ["name", "rate", "hours"] : ["rate" gte 20];
high_rates.balance = high_rates.rate * high_rates.hours;
high_rates
#+end_src

View File

@ -29,5 +29,5 @@ section = "utility"
priority = "optional"
assets = [
["target/release/abacus", "usr/bin/", "755"],
["README.md", "usr/share/doc/abacus/README", "644"],
["README.org", "usr/share/doc/abacus/README", "644"],
]