Skip to content

Commit 860dd02

Browse files
committed
refine in README
1 parent 4ea255b commit 860dd02

File tree

1 file changed

+14
-22
lines changed

1 file changed

+14
-22
lines changed

README.md

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,57 +43,46 @@ Snippets evaling:
4343

4444
```bash
4545
cr eval 'range 100'
46-
```
47-
48-
multi-lines snippet:
49-
50-
```bash
51-
cr eval '
5246

53-
println "|a demo"
54-
55-
->
56-
range 100
57-
map $ fn (x)
58-
* x x
59-
60-
'
47+
cr eval 'thread-first 100 range (map $ \ * % %)'
6148
```
6249

6350
Run with a [compact.cirru](https://github.com/calcit-lang/lilac/blob/main/compact.cirru):
6451

6552
```bash
6653
cr compact.cirru -1 # run only once
6754

68-
cr compact.cirru # watch mode enabled by default
55+
cr -1 # by default, it picks `compact.cirru`
56+
57+
cr # watch mode enabled by default
6958
```
7059

7160
By default Calcit reads `:init-fn` and `:reload-fn` inside `compact.cirru` configs. You may also specify functions,
7261

7362
```bash
74-
cr compact.cirru --init-fn='app.main/main!' --reload-fn='app.main/reload!'
63+
cr --init-fn='app.main/main!' --reload-fn='app.main/reload!'
7564
```
7665

7766
and even configure `:entries` in `compact.cirru`:
7867

7968
```bash
80-
cr compact.cirru --entry server
69+
cr --entry server
8170
```
8271

8372
### JavaScript codegen
8473

8574
It compiles to JavaScript and runs in consistet semantics. However it might require a lot of JavaScript interop.
8675

8776
```bash
88-
cr compact.cirru js # compile to js
89-
cr compact.cirru js --emit-path=out/ # compile to js and save in `out/`
77+
cr js # compile to js, also picks `compact.cirru` by default
78+
cr js --emit-path=out/ # compile to js and save in `out/`
9079
```
9180

9281
By default, js code is generated to `js-out/`. You will need Vite or Node to run it, from an entry file:
9382

9483
```js
9584
import { main_$x_, reload_$x_ } from "./js-out/app.main.mjs";
96-
main_$x_();
85+
main_$x_(); // which corresponds to `main!` function in calcit
9786
```
9887

9988
### Calcit Editor & Bundler
@@ -111,14 +100,17 @@ Read more in [Respo Calcit Workflow](https://github.com/calcit-lang/respo-calcit
111100

112101
```cirru
113102
{}
103+
:calcit-version |0.9.8
114104
:dependencies $ {}
115105
|calcit-lang/memof |0.0.11
116106
|calcit-lang/lilac |main
117107
```
118108

119109
Run `caps` to download. Sources are downloaded into `~/.config/calcit/modules/`. If a module contains `build.sh`, it will be executed mostly for compiling Rust dylibs.
120110

121-
To load modules, use `:modules` configuration in `calcit.cirru` and `compact.cirru`:
111+
`:calcit-version` helps in check version, and provides hints in [CI](https://github.com/calcit-lang/setup-cr) environment.
112+
113+
To load modules, use `:modules` configuration and `compact.cirru`(which normally generated from `calcit.cirru`):
122114

123115
```cirru
124116
:configs $ {}
@@ -128,7 +120,7 @@ To load modules, use `:modules` configuration in `calcit.cirru` and `compact.cir
128120
Paths defined in `:modules` field are just loaded as files from `~/.config/calcit/modules/`,
129121
i.e. `~/.config/calcit/modules/memof/compact.cirru`.
130122

131-
Modules that ends with `/`s are automatically suffixed `compact.cirru` since it's the default filename.
123+
Modules that ends with `/`s are automatically suffixed `compact.cirru` since it's the default entry.
132124

133125
### Development
134126

0 commit comments

Comments
 (0)