aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md61
1 files changed, 60 insertions, 1 deletions
diff --git a/README.md b/README.md
index eb7f2b7..512d881 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,62 @@
# computorv2
-computorv2 project of school 42
+Calculator REPL
+
+## Types
+
+| Name | Letter | Example |
+|----------|--------|----------------------|
+| Rational | Q | `1.5` |
+| Complex | C | `1.5i + 1.5` |
+| Matrix | M | `[ [1, 2]; [3, 4] ]` |
+
+Imaginary number are converted to Complex.
+
+## Operations
+
+* `+` Addition
+* `-` Substraction
+* `*` Multiplication
+* `/` Division
+* `%` Modulo
+* `^` Exponent
+* `**` Matrix multiplication
+
+| | Q | C | M |
+|---|------------------------------|-------------------------|---------------------|
+| Q | `+`, `-`, `*`, `/`, `^`, `%` | `+`, `-`, `*`, `/`, `^` | `*` |
+| C | | `+`, `-`, `*`, `/`, `^` | `*` |
+| M | | | `**`, `+`, `-`, `*` |
+
+## Expressions
+
+* Declaration
+ * Variable
+ * Function (with one parameter)
+* Evaluation
+
+### Examples
+
+```
+> a = 1 + 3
+4
+> f(x) = x * 2
+x * 2
+> a = ?
+4
+> f(4) = ?
+16
+> f(4) + a + 5 = ?
+25
+```
+
+Uses eager evaluation, variable value is known after assignment, function value is reduced to the maximum (except for parameter).
+
+```
+> a = 3
+3
+> b = a + 3
+6
+> f(x) = 2 * 3 * 4 * x
+24 * x
+```