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
{{ message }}
Repository navigation
Commit cd9aeca
Browse filesBrowse the repository at this point in the historyBrowse files
[ClojureScript](https://clojurescript.org/) is a robust, practical, and fast programming language with a set of useful features that together form a simple, coherent, and powerful tool.
4
+
5
+
ClojureScript is a compiler for [Clojure](https://clojure.org/) that targets
6
+
JavaScript. <br />In LiveCodes, it runs in the browser using
7
+
[Cherry](https://github.com/squint-cljs/cherry).
8
+
9
+
:::warning Deprecation
10
+
11
+
The language aliases: `clojurescript`, `cljs`, `cljc`, `clj`, `edn`, `clojure` will use the [self-hosted ClojureScript compiler](./clojurescript.mdx) in the future.
12
+
If you want to use the Cherry-based ClojureScript compiler, use the alias: `clojurescript-cherry` or `cljs-cherry` instead.
If `JSX` is used (using `#jsx` reader tag - [example](https://github.com/squint-cljs/cherry/blob/60adcf6e3a8fb940a80c6a193599da0272fe3058/examples/jsx/pages/component.cljs)), it is also compiled ([JSX](./jsx.mdx)). See [example usage](#example-usage).
37
+
38
+
### Version
39
+
40
+
`cherry-cljs`: v0.6.38
41
+
42
+
## Code Formatting
43
+
44
+
Using [Parinfer](https://shaunlebron.github.io/parinfer/).
cljs: `(ns demo\n${''};; you can use npm modules\n${''}(:require ["canvas-confetti$default" :as confetti]))\n\n(let [el (js/document.getElementById "test")]\n${''}(.addEventListener el "click"\n ${''}(fn []\n ${''}(confetti)\n${''}(println "test"))))\n`,
52
+
html: '<button id="test">test</button>',
53
+
console: 'open',
54
+
};
55
+
56
+
<LiveCodesparams={params}></LiveCodes>
57
+
58
+
Using React (with JSX):
59
+
60
+
<LiveCodestemplate="clojurescript"></LiveCodes>
61
+
62
+
## Starter Template
63
+
64
+
https://livecodes.io/?template=clojurescript
65
+
66
+
## Links
67
+
68
+
-[ClojureScript official website](https://clojurescript.org/)
[ClojureScript](https://clojurescript.org/) is a robust, practical, and fast programming language with a set of useful features that together form a simple, coherent, and powerful tool.
4
4
5
5
ClojureScript is a compiler for [Clojure](https://clojure.org/) that targets
6
-
JavaScript. <br />In LiveCodes, it runs in the browser using
7
-
[Cherry](https://github.com/squint-cljs/cherry).
6
+
JavaScript. <br />In LiveCodes, it runs in the browser using the official
Lisp language family supported in LiveCodes includes [Common Lisp](./commonlisp.mdx), [Scheme](./scheme.mdx), [ClojureScript](./clojurescript.mdx) and [Fennel](./fennel.mdx).
14
+
The `clojurescript`, `cljs`, `clj`, `cljc`, `edn` and `clojure` aliases currently use the
15
+
Cherry-based ClojureScript compiler and will switch to this self-hosted compiler in the future.
16
+
Use the [`clojurescript-cherry`](./clojurescript-cherry.mdx) alias to keep using Cherry.
If `JSX` is used (using `#jsx` reader tag - [example](https://github.com/squint-cljs/cherry/blob/60adcf6e3a8fb940a80c6a193599da0272fe3058/examples/jsx/pages/component.cljs)), it is also compiled ([JSX](./jsx.mdx)). See [example usage](#example-usage).
36
+
The official [ClojureScript compiler](https://clojurescript.org/), self-hosted in the compiler worker.
34
37
35
38
### Version
36
39
37
-
`cherry-cljs`: v0.2.18
40
+
`@live-codes/cljs-selfhosted-compiler`: v0.3.0
41
+
42
+
## Usage
43
+
44
+
LiveCodes compiles ClojureScript to JavaScript in the browser using the official compiler,
45
+
self-hosted in the compiler worker. This provides real `cljs.core` semantics and real analyzer
46
+
diagnostics.
47
+
48
+
`(:require ...)` can resolve the namespaces that are bundled with the compiler:
49
+
50
+
-`cljs.core`
51
+
-`clojure.string`
52
+
-`clojure.set`
53
+
-`clojure.walk`
54
+
-`clojure.edn`
55
+
-`cljs.pprint`
56
+
-`clojure.core.reducers`
57
+
-`clojure.core.protocols`
58
+
-`clojure.data`
59
+
-`clojure.zip`
60
+
-`clojure.datafy`
61
+
-`cljs.math`
62
+
-`cljs.proxy`
63
+
-`cljs.stacktrace`
64
+
-`cljs.test`
65
+
66
+
Three reader namespaces are also require-able, because they are already present in the page runtime:
67
+
68
+
-`cljs.reader`
69
+
-`cljs.tools.reader`
70
+
-`cljs.tools.reader.edn`
38
71
39
-
## Code Formatting
72
+
They (and the `cljs.tools.reader.reader-types` and `cljs.tools.reader.impl.*` namespaces under them)
73
+
are already present in the page runtime because `clojure.edn` pulls them in transitively, so they
74
+
cost nothing extra; they are listed here because they are require-able and work.
40
75
41
-
Using [Parinfer](https://shaunlebron.github.io/parinfer/).
76
+
`defmacro` works and is evaluated at compile time. Source maps are on by default.
42
77
43
-
## Example Usage
78
+
`cljs.test`'s macros expand in the compiler worker like any other macro. `deftest`, `is`,
79
+
`testing` and `run-tests` come from its `cljs/test.cljc` macros half, and `are` expands through
80
+
`clojure.template`, which is served to the worker next to it. The compiled test file is page
81
+
JavaScript that calls `cljs.test`'s runtime (`cljs/test.cljs`), which the page provides alongside
cljs: `(ns demo\n${''};; you can use npm modules\n${''}(:require ["canvas-confetti$default" :as confetti]))\n\n(let [el (js/document.getElementById "test")]\n${''}(.addEventListener el "click"\n ${''}(fn []\n ${''}(confetti)\n${''}(println "test"))))\n`,
49
-
html: '<button id="test">test</button>',
50
-
console: 'open',
86
+
This example demonstrates usage and JavaScript interoperability:
Copy file name to clipboardExpand all lines: docs/docs/languages/commonlisp.mdx
-6Lines changed: 0 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,12 +4,6 @@
4
4
5
5
In LiveCodes, Common Lisp code runs in the browser using [JSCL](https://github.com/jscl-project/jscl), a Common Lisp to JavaScript compiler.
6
6
7
-
:::info Note
8
-
9
-
Lisp language family supported in LiveCodes includes [Common Lisp](./commonlisp.mdx), [Scheme](./scheme.mdx), [ClojureScript](./clojurescript.mdx) and [Fennel](./fennel.mdx).
10
-
11
-
:::
12
-
13
7
## Usage
14
8
15
9
LiveCodes runs Common Lisp code in the browser. JSCL implements a subset of Common Lisp, but covers enough functionality to write practical code.
Copy file name to clipboardExpand all lines: docs/docs/languages/fennel.mdx
-6Lines changed: 0 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,12 +4,6 @@
4
4
5
5
Fennel code is compiled to Lua, which then runs in the browser using [Fengari](https://fengari.io/). See documentation for Lua language support in LiveCodes [here](./lua.mdx).
6
6
7
-
:::info Note
8
-
9
-
Lisp language family supported in LiveCodes includes [Common Lisp](./commonlisp.mdx), [Scheme](./scheme.mdx), [ClojureScript](./clojurescript.mdx) and [Fennel](./fennel.mdx).
10
-
11
-
:::
12
-
13
7
## Usage
14
8
15
9
JavaScript interoperability and DOM access is achieved using [`"js"` module](https://github.com/fengari-lua/fengari-interop).
Copy file name to clipboardExpand all lines: docs/docs/languages/scheme.mdx
+2-10Lines changed: 2 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,12 +4,6 @@
4
4
5
5
In LiveCodes, Scheme code runs in the browser using [BiwaScheme](https://www.biwascheme.org/), a Scheme interpreter written in JavaScript.
6
6
7
-
:::info Note
8
-
9
-
Lisp language family supported in LiveCodes includes [Common Lisp](./commonlisp.mdx), [Scheme](./scheme.mdx), [ClojureScript](./clojurescript.mdx) and [Fennel](./fennel.mdx).
10
-
11
-
:::
12
-
13
7
## Usage
14
8
15
9
LiveCodes runs Scheme code in the browser. BiwaScheme [implements](https://www.biwascheme.org/doc/features.html) most of the features of [R7RS small](https://small.r7rs.org/), including first-class continuation and tail call optimization.
0 commit comments