metaclj-js
所属分类:collect
开发工具:Clojure
文件大小:0KB
下载次数:0
上传日期:2017-08-18 15:10:28
上 传 者:
sh-1993
说明: Clojure的分段JavaScript元编程,
(Staged JavaScript Metaprogramming from Clojure,)
文件列表:
LICENSE (11219, 2017-08-18)
doc/ (0, 2017-08-18)
doc/intro.md (1134, 2017-08-18)
project.clj (422, 2017-08-18)
src/ (0, 2017-08-18)
src/metaclj/ (0, 2017-08-18)
src/metaclj/js.clj (845, 2017-08-18)
src/metaclj/js/ (0, 2017-08-18)
src/metaclj/js/core.clj (1500, 2017-08-18)
src/metaclj/js/emit.clj (5131, 2017-08-18)
src/metaclj/js/env.clj (3986, 2017-08-18)
src/metaclj/js/expand.clj (5714, 2017-08-18)
src/metaclj/js/operators.clj (719, 2017-08-18)
src/metaclj/js/parse.clj (5912, 2017-08-18)
src/metaclj/js/quote.clj (1196, 2017-08-18)
src/metaclj/js/rhino.clj (1263, 2017-08-18)
src/metaclj/util.clj (192, 2017-08-18)
test/ (0, 2017-08-18)
test/metaclj/ (0, 2017-08-18)
test/metaclj/js_test.clj (3954, 2017-08-18)
# MetaCLJ - JavaScript
Staged metaprogramming of JavaScript from Clojure.
Compare to [Terra][1]/C.
## Usage
Don't.
This library exists to power the JavaScript backend of another compiler I'm
working on. I've only published this for the curious.
Here's a small example without any of the context you'd need to understand it:
```clojure
(require '[metaclj.js :as js :refer [js]])
(js/require 'metaclj.js.core :refer :all)
(let [n 5]
(js/eval
(iife
(let x 1)
(for [(let y 1) (<= y n) (++ y)]
(set! x (* x y)))
(return x))))
```
This evaluates to `120` and is compiled as:
```javascript
(function(){
let x = 1;
for (let y = 1; y <= 5; ++y) {
x = x * y;
};
return x;
})()
```
Some notes can be found in the [doc directory](https://github.com/brandonbloom/metaclj-js/blob/master/./doc).
Lots more docs to write... eventually... maybe.
## Relationship To MetaCLJ
This project was forked from an early version of [MetaCLJ][2]. Although
unlikely to be worth the trouble, they could potentially be reunited someday.
## License
Copyright 2016 Brandon Bloom
Distributed under the Eclipse Public License version 1.0.
[1]: http://terralang.org
[2]: https://github.com/brandonbloom/metaclj
近期下载者:
相关文件:
收藏者: