Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ jobs:
test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
cache: 'yarn'

- uses: supplypike/setup-bin@v3
with:
uri: 'https://github.com/calcit-lang/calcit/releases/download/0.8.0-a5/cr'
uri: 'https://github.com/calcit-lang/calcit/releases/download/0.8.2/cr'
name: 'cr'
version: '0.8.0-a5'
version: '0.8.2'

- uses: supplypike/setup-bin@v3
with:
uri: 'https://github.com/calcit-lang/calcit/releases/download/0.8.0-a5/caps'
uri: 'https://github.com/calcit-lang/calcit/releases/download/0.8.2/caps'
name: 'caps'
version: '0.8.0-a5'
version: '0.8.2'
- name: "compiles to js"
run: >
caps --ci && cr --emit-js --once
Expand Down
14 changes: 0 additions & 14 deletions assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,3 @@ body * {
.md-block .md-p a {
white-space: pre;
}

.main-title {
font-size: 40px;
line-height: 48px;
font-weight: bold;
font-family: Federo, cursive;
}

.secondary-title {
font-size: 24px;
line-height: 30px;
font-weight: 500;
/*font-family: Federo, cursive;*/
}
1,659 changes: 1,412 additions & 247 deletions calcit.cirru

Large diffs are not rendered by default.

238 changes: 191 additions & 47 deletions compact.cirru

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions content/cirru.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

### Cirru

Also see [Cirru Project](http://cirru.org/) for higher goals of auto-layout code editor, which is Calcit's default editor.

Example of a `compact.cirru` file generated from calcit-editor:

```cirru
{} (:package |app)
:configs $ {} (:init-fn |app.main/main!) (:reload-fn |app.main/reload!)
:modules $ []
:files $ {}
|app.main $ %{} :FileEntry
:defs $ {}
|main! $ quote
defn main! () (+ 1 2)
|reload! $ quote
defn reload! ()
:ns $ quote
ns app.main $ :require
```

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

There's also a "Cirru EDN" format for data.
90 changes: 0 additions & 90 deletions content/intro.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

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.

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

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

## Features

* Immutable Data

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.

* Lisp(Code is Data)

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.

* Indentations-based Syntax

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.

* Hot code swapping

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.

* ES Modules Syntax

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.

### Eco-system

Libraries:

[Calcit Std Libraries](https://github.com/calcit-lang/calcit.std)
[Memof: memoization library with caching](https://github.com/calcit-lang/memof)
[Lilac: validation library](https://github.com/calcit-lang/lilac)
[Recollect: Diff/patch library designed for Cumulo project](https://github.com/calcit-lang/recollect)
[Calcit WebSocket server binding](https://github.com/calcit-lang/calcit-wss)

Frameworks:

[Respo: virtual DOM library](https://github.com/Respo/respo.calcit)
[Phlox: virtual DOM like wrapper on top of PIXI](https://github.com/Quamolit/phlox.calcit)
[Quamolit: what if we make animations in React's way?](https://github.com/Quamolit/quamolit.calcit)
[Quaterfoil: thin virtual DOM wrapper over three.js](https://github.com/Quamolit/quatrefoil.calcit)
[Cumulo: template for tiny realtime apps](https://github.com/Cumulo/cumulo-workflow.calcit)

Tools:

[Calcit IR viewer](https://github.com/calcit-lang/calcit-ir-viewer)
[Calcit Error viewer](https://github.com/calcit-lang/calcit-error-viewer)
[Calcit Paint: play with 2d shapes(experimental)](https://github.com/calcit-lang/calcit-paint)

### Recent Posts

Videos:

[Calcit-js 开发的阶段介绍 2021-11](https://www.bilibili.com/video/BV1Yg411K73P)
[calcit-js 开发记录(21-01-22) 关于 ternary-tree.ts 重构](https://www.bilibili.com/video/BV1Ht4y167Fg)
[calcit-js 阶段介绍(2021-01)](https://www.bilibili.com/video/BV1H5411n7su)
[calcit-runner 阶段记录介绍(2021-01)](https://www.bilibili.com/video/BV1cK4y1W7dZ)

Articles:

[Calcit 脚本语言一些基础介绍](https://zhuanlan.zhihu.com/p/394791973)
[Introducing calcit-js: toy language inspired by cljs](https://clojureverse.org/t/introducing-calcit-js-toy-language-inspired-by-cljs/7097)
[An indentation way to Lisp](https://github.com/calcit-lang/calcit-runner/discussions/123)
[Problems encountered in generating js](https://github.com/calcit-lang/calcit-runner.nim/discussions/148)
[calcit-js 的 JavaScript 代码生成与疑难](https://github.com/calcit-lang/calcit-runner.nim/discussions/184)
[ternary-tree.ts: 关于初期的性能优化(on early optimizations)](https://github.com/calcit-lang/ternary-tree.ts/discussions/7)
[A trick for cheaper persistent list in JavaScript](https://clojureverse.org/t/a-trick-for-cheaper-persistent-list-in-javascript/7172)

### Cirru

Also see [Cirru Project](http://cirru.org/) for higher goals of auto-layout code editor, which is Calcit's default editor.

Example of a `compact.cirru` file generated from calcit-editor:

```cirru
{} (:package |app)
:configs $ {} (:init-fn |app.main/main!) (:reload-fn |app.main/reload!)
:modules $ []
:files $ {}
|app.main $ {}
:ns $ quote
ns app.main $ :require
:defs $ {}
|main! $ quote
defn main! () (+ 1 2)
|reload! $ quote
defn reload! ()
```

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

There's also a "Cirru EDN" format for data.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dependencies": {
"@calcit/procs": "^0.8.0-a5",
"@calcit/procs": "^0.8.2",
"cirru-color": "^0.2.3"
},
"devDependencies": {
Expand Down
20 changes: 10 additions & 10 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.