https://github.com/olical/clojs
Repository for my post: A JavaScript / Clojure mashup
https://github.com/olical/clojs
Last synced: 28 days ago
JSON representation
Repository for my post: A JavaScript / Clojure mashup
- Host: GitHub
- URL: https://github.com/olical/clojs
- Owner: Olical
- License: unlicense
- Created: 2014-12-16T00:20:30.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-12-17T20:35:21.000Z (over 11 years ago)
- Last Synced: 2025-02-23T13:52:23.499Z (over 1 year ago)
- Language: JavaScript
- Homepage: http://oli.me.uk/2014/12/15/a-javascript-clojure-mashup/
- Size: 106 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Repository for my post: [A JavaScript / Clojure mashup](http://oli.me.uk/2014/12/15/a-javascript-clojure-mashup/).
The following Clojure and JavaScript examples are equivalent. Both data structures are executed in a similar fashion and with an identical result. Please read the post for more information.
```clojure
(if (> 10 20)
"Uh, well this is awkward."
(str "EVERYTHING IS FINE, MOVE ALONG " (reduce + [2 2 3])))
```
```javascript
[$if, [$mt, 10, 20],
'Uh, well this is awkward.',
[str, 'EVERYTHING IS FINE, MOVE ALONG ', [reduce, $add, quote([1, 2, 3])]]];
```
Obviously the missing functions (`$mt`, `str`, `reduce` and `$add`. `$mt` means "more than") and the `$if` macro (yes, it's a macro. It manipulates the tree) are defined in the JavaScript file.
This isn't exactly a library, just an experiment. I may well take it further one day though because I found it really interesting.
## License
This repository is licensed under [the unlicense](http://unlicense.org/), so you can basically do what you want. Find the full thing in the `UNLICENSE` file.
>This is free and unencumbered software released into the public domain.
>
>Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.