Skip to content

Commit 1549ab0

Browse files
authored
Merge pull request #259 from calcit-lang/download
caps Download; thread-first aliases
2 parents b43af16 + 860dd02 commit 1549ab0

File tree

8 files changed

+134
-97
lines changed

8 files changed

+134
-97
lines changed

Cargo.lock

Lines changed: 45 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "calcit"
3-
version = "0.9.7"
3+
version = "0.9.8"
44
authors = ["jiyinyiyong <jiyinyiyong@gmail.com>"]
55
edition = "2021"
66
license = "MIT"
@@ -20,9 +20,9 @@ cirru_edn = "0.6.13"
2020
cirru_parser = "0.1.31"
2121
# cirru_parser = { path = "/Users/chenyong/repo/cirru/parser.rs" }
2222
argh = "0.1.13"
23-
dirs = "5.0.1"
24-
notify = "7.0.0"
25-
notify-debouncer-mini = "0.5.0"
23+
dirs = "6.0.0"
24+
notify = "8.0.0"
25+
notify-debouncer-mini = "0.6.0"
2626
walkdir = "2.5.0"
2727
hex = "0.4.3"
2828
rpds = "1.1.0"

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)