You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/intro.md
+20-10Lines changed: 20 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,46 +3,56 @@ Calcit is an interpreter built with Rust, and also a JavaScript code emitter. It
3
3
4
4
## Install & Try
5
5
6
-
You can [try Calcit WASM build online](http://repo.calcit-lang.org/calcit-wasm-play/) for simple snippets.
7
-
8
-
To install at local, build from source via `cargo install --path=./`. Ubuntu 20.04 binaries can be found on [bin.calcit-lang.org](http://bin.calcit-lang.org/linux/). Try command line:
6
+
You can [try Calcit WASM build online](http://repo.calcit-lang.org/calcit-wasm-play/) for simple snippets. An also install Calcit locally with Cargo:
9
7
8
+
```bash
9
+
cargo install calcit
10
10
```
11
-
cr -e '
12
11
13
-
println "|a demo"
12
+
Command line called `cr` is avaliable, which stands for "Calcit Runner". Eval snippets via:
13
+
14
+
```
15
+
cr -e 'println "|a demo"'
16
+
```
14
17
18
+
```
19
+
cr -e '
15
20
->
16
21
range 100
17
22
map $ fn (x)
18
23
* x x
19
24
foldl 0 &+
20
25
println
26
+
'
27
+
```
21
28
29
+
```
30
+
cr -e '
22
31
println $ {}
23
32
:a 100
24
33
:b $ {}
25
34
:c 200
26
35
:d $ [] 1 2 3 4
27
-
28
36
'
29
37
```
30
38
31
-
It's hot-swapping friendly when you use [calcit-editor](https://github.com/calcit-lang/editor). Install it and run `ct` to launch editor server, which writes `compact.cirru` and `.compact-inc.cirru` on saving. Try launching example by cloning [Calcit Workflow](https://github.com/calcit-lang/calcit-workflow).
39
+
Ubuntu 20.04 binaries can be found on [bin.calcit-lang.org](http://bin.calcit-lang.org/linux/) for running in CI environments.
40
+
41
+
Read more in [Minimal Calcit](https://github.com/calcit-lang/minimal-calcit/blob/main/README.md) to learn how to code Calcit with a **plain text editor**. You will need another command `bundle_calcit` for bundling individual files.
32
42
33
-
Read more in [Minimal Calcit](https://github.com/calcit-lang/minimal-calcit/blob/main/README.md) to learn how to code Calcit with a **plain text editor**.
43
+
It's hot-swapping friendly when you use [calcit-editor](https://github.com/calcit-lang/editor). Install it and run `ct`to launch editor server, which writes `compact.cirru` and `.compact-inc.cirru` on saving. Try launching example by cloning [Calcit Workflow](https://github.com/calcit-lang/calcit-workflow).
34
44
35
45
## Features
36
46
37
47
* Immutable Data
38
48
39
-
Values and states are represented in different data structures, which is the semantics from functional programming. Internally it's [im](https://crates.io/crates/im) in Rust and a custom [finger tree](https://github.com/calcit-lang/ternary-tree.ts) in JavaScript.
49
+
Values and states are represented in different data structures, which is the semantics from functional programming. Internally it's [rpds](https://docs.rs/rpds/) in Rust and a custom [2-3 tree](https://github.com/calcit-lang/ternary-tree.ts) in JavaScript.
40
50
41
51
* Lisp(Code is Data)
42
52
43
53
Calcit-js was designed based on experiences from ClojureScript, with a bunch of builtin macros. It offers similar experiences to ClojureScript. So Calcit offers much power via macros, while keeping its core simple.
44
54
45
-
* Indentations
55
+
* Indentations-based Syntax
46
56
47
57
With `bundle_calcit` command, Calcit code can be written as an indentation-based language. So you don't have to match parentheses like in Clojure. It also means now you need to handle indentations very carefully.
0 commit comments