https://github.com/roman01la/libx.core
Enhanced Clojure's standard library
https://github.com/roman01la/libx.core
clojure macros
Last synced: 6 months ago
JSON representation
Enhanced Clojure's standard library
- Host: GitHub
- URL: https://github.com/roman01la/libx.core
- Owner: roman01la
- Created: 2016-11-16T18:17:05.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-10-03T19:49:26.000Z (over 7 years ago)
- Last Synced: 2025-02-16T03:32:50.604Z (11 months ago)
- Topics: clojure, macros
- Language: Clojure
- Homepage:
- Size: 24.4 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# libx.core
Enhanced Clojure's standard library
Try it in REPL:
```sh
clj -Sdeps '{:deps {github-roman01la/libx {:git/url "https://github.com/roman01la/libx.core" :sha "c46fcb64fda074bcf4fa9116ccbe17efd073e1c8"}}}'
```
## Features
### Lightweight `doseq`
Expands into `loop` for simple form `(doseq [x coll] ...)`
- [ ] Unroll into a sequence of expressions for constant `coll` values
### Lightweight `for`
Expands into `loop` returning `lazy-seq` for simple form `(for [x coll] ...)`
- [ ] Unroll into a sequence of expressions for constant `coll` values
### Collection transforms fusion in `->>` macro
- [x] 2+ adjacent `map`
- [x] 2+ adjacent `mapv`
- [x] 2+ adjacent `filter`
- [x] 2+ adjacent `filterv`
- [x] adjacent `map` and `filter`, `mapv` and `filterv`
- [ ] arbitrary mixed `map/v` and `filter/v`
### `if-keys` & `when-keys`
When all symbols in destructuring form are evaluated to `true`, evaluates body with those symbols bound to corresponding values in a map.
```clojure
(when-keys [{:keys [a b]} {:a 1 :b 2}]
(println a b))
```
### `let` with JavaScript object destructuring
```clojure
(require '[goog.object :as obj])
(let [{:goog.object/keys [x y]} #js {:x 1 :y 2}
{::obj/keys [z]} #js {:z 3}] ;; <- with namespace aliased namespaced keyword
...)
```