Skip to content

Commit d678d26

Browse files
authored
Merge pull request #21 from calcit-lang/snippet
update compact.cirru snippet
2 parents d2ad3cd + d4dc890 commit d678d26

File tree

8 files changed

+1645
-415
lines changed

8 files changed

+1645
-415
lines changed

.github/workflows/upload.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,24 @@ jobs:
1010
test:
1111
runs-on: ubuntu-22.04
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414

1515
- uses: actions/setup-node@v3
1616
with:
17-
node-version: 18
17+
node-version: 20
1818
cache: 'yarn'
1919

2020
- uses: supplypike/setup-bin@v3
2121
with:
22-
uri: 'https://github.com/calcit-lang/calcit/releases/download/0.8.0-a5/cr'
22+
uri: 'https://github.com/calcit-lang/calcit/releases/download/0.8.2/cr'
2323
name: 'cr'
24-
version: '0.8.0-a5'
24+
version: '0.8.2'
2525

2626
- uses: supplypike/setup-bin@v3
2727
with:
28-
uri: 'https://github.com/calcit-lang/calcit/releases/download/0.8.0-a5/caps'
28+
uri: 'https://github.com/calcit-lang/calcit/releases/download/0.8.2/caps'
2929
name: 'caps'
30-
version: '0.8.0-a5'
30+
version: '0.8.2'
3131
- name: "compiles to js"
3232
run: >
3333
caps --ci && cr --emit-js --once

assets/main.css

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,3 @@ body * {
7373
.md-block .md-p a {
7474
white-space: pre;
7575
}
76-
77-
.main-title {
78-
font-size: 40px;
79-
line-height: 48px;
80-
font-weight: bold;
81-
font-family: Federo, cursive;
82-
}
83-
84-
.secondary-title {
85-
font-size: 24px;
86-
line-height: 30px;
87-
font-weight: 500;
88-
/*font-family: Federo, cursive;*/
89-
}

calcit.cirru

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

compact.cirru

Lines changed: 191 additions & 47 deletions
Large diffs are not rendered by default.

content/cirru.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
### Cirru
3+
4+
Also see [Cirru Project](http://cirru.org/) for higher goals of auto-layout code editor, which is Calcit's default editor.
5+
6+
Example of a `compact.cirru` file generated from calcit-editor:
7+
8+
```cirru
9+
{} (:package |app)
10+
:configs $ {} (:init-fn |app.main/main!) (:reload-fn |app.main/reload!)
11+
:modules $ []
12+
:files $ {}
13+
|app.main $ %{} :FileEntry
14+
:defs $ {}
15+
|main! $ quote
16+
defn main! () (+ 1 2)
17+
|reload! $ quote
18+
defn reload! ()
19+
:ns $ quote
20+
ns app.main $ :require
21+
```
22+
23+
If you want to write in a text editor, check out `bundle_calcit` command in project. 也可以查看相关中文[介绍视频](https://www.bilibili.com/video/BV1ry4y1W7VW?from=search&seid=17614445788882056969).
24+
25+
There's also a "Cirru EDN" format for data.

content/intro.md

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Calcit is an interpreter built with Rust, and also a JavaScript code emitter. It's inspired mostly by ClojureScript. Calcit-js emits JavaScript in ES Modules syntax.
32

43
## Install & Try
@@ -42,92 +41,3 @@ Read more in [Minimal Calcit](https://github.com/calcit-lang/minimal-calcit/blob
4241

4342
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).
4443

45-
## Features
46-
47-
* Immutable Data
48-
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.
50-
51-
* Lisp(Code is Data)
52-
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.
54-
55-
* Indentations-based Syntax
56-
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.
58-
59-
* Hot code swapping
60-
61-
Calcit was built with hot swapping in mind. Combined with [calcit-editor](https://github.com/calcit-lang/editor), it watches code changes by default, and re-runs program on updates. For calcit-js, it works with Vite and Webpack to reload, learning from Elm, ClojureScript and React.
62-
63-
* ES Modules Syntax
64-
65-
To leverage the power of modern browsers with help of Vite, we need another ClojureScript that emits `import`/`export` for Vite. Calcit-js does this! And this page is built with Calcit-js as well, open Console to find out more.
66-
67-
### Eco-system
68-
69-
Libraries:
70-
71-
[Calcit Std Libraries](https://github.com/calcit-lang/calcit.std)
72-
[Memof: memoization library with caching](https://github.com/calcit-lang/memof)
73-
[Lilac: validation library](https://github.com/calcit-lang/lilac)
74-
[Recollect: Diff/patch library designed for Cumulo project](https://github.com/calcit-lang/recollect)
75-
[Calcit WebSocket server binding](https://github.com/calcit-lang/calcit-wss)
76-
77-
Frameworks:
78-
79-
[Respo: virtual DOM library](https://github.com/Respo/respo.calcit)
80-
[Phlox: virtual DOM like wrapper on top of PIXI](https://github.com/Quamolit/phlox.calcit)
81-
[Quamolit: what if we make animations in React's way?](https://github.com/Quamolit/quamolit.calcit)
82-
[Quaterfoil: thin virtual DOM wrapper over three.js](https://github.com/Quamolit/quatrefoil.calcit)
83-
[Cumulo: template for tiny realtime apps](https://github.com/Cumulo/cumulo-workflow.calcit)
84-
85-
Tools:
86-
87-
[Calcit IR viewer](https://github.com/calcit-lang/calcit-ir-viewer)
88-
[Calcit Error viewer](https://github.com/calcit-lang/calcit-error-viewer)
89-
[Calcit Paint: play with 2d shapes(experimental)](https://github.com/calcit-lang/calcit-paint)
90-
91-
### Recent Posts
92-
93-
Videos:
94-
95-
[Calcit-js 开发的阶段介绍 2021-11](https://www.bilibili.com/video/BV1Yg411K73P)
96-
[calcit-js 开发记录(21-01-22) 关于 ternary-tree.ts 重构](https://www.bilibili.com/video/BV1Ht4y167Fg)
97-
[calcit-js 阶段介绍(2021-01)](https://www.bilibili.com/video/BV1H5411n7su)
98-
[calcit-runner 阶段记录介绍(2021-01)](https://www.bilibili.com/video/BV1cK4y1W7dZ)
99-
100-
Articles:
101-
102-
[Calcit 脚本语言一些基础介绍](https://zhuanlan.zhihu.com/p/394791973)
103-
[Introducing calcit-js: toy language inspired by cljs](https://clojureverse.org/t/introducing-calcit-js-toy-language-inspired-by-cljs/7097)
104-
[An indentation way to Lisp](https://github.com/calcit-lang/calcit-runner/discussions/123)
105-
[Problems encountered in generating js](https://github.com/calcit-lang/calcit-runner.nim/discussions/148)
106-
[calcit-js 的 JavaScript 代码生成与疑难](https://github.com/calcit-lang/calcit-runner.nim/discussions/184)
107-
[ternary-tree.ts: 关于初期的性能优化(on early optimizations)](https://github.com/calcit-lang/ternary-tree.ts/discussions/7)
108-
[A trick for cheaper persistent list in JavaScript](https://clojureverse.org/t/a-trick-for-cheaper-persistent-list-in-javascript/7172)
109-
110-
### Cirru
111-
112-
Also see [Cirru Project](http://cirru.org/) for higher goals of auto-layout code editor, which is Calcit's default editor.
113-
114-
Example of a `compact.cirru` file generated from calcit-editor:
115-
116-
```cirru
117-
{} (:package |app)
118-
:configs $ {} (:init-fn |app.main/main!) (:reload-fn |app.main/reload!)
119-
:modules $ []
120-
:files $ {}
121-
|app.main $ {}
122-
:ns $ quote
123-
ns app.main $ :require
124-
:defs $ {}
125-
|main! $ quote
126-
defn main! () (+ 1 2)
127-
|reload! $ quote
128-
defn reload! ()
129-
```
130-
131-
If you want to write in a text editor, check out `bundle_calcit` command in project. 也可以查看相关中文[介绍视频](https://www.bilibili.com/video/BV1ry4y1W7VW?from=search&seid=17614445788882056969).
132-
133-
There's also a "Cirru EDN" format for data.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"dependencies": {
3-
"@calcit/procs": "^0.8.0-a5",
3+
"@calcit/procs": "^0.8.2",
44
"cirru-color": "^0.2.3"
55
},
66
"devDependencies": {

yarn.lock

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

0 commit comments

Comments
 (0)