Skip to content
Open
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ pom.xml.asc
.lein-failures
.lein-plugins
.lein-repl-history
.idea
thread-expr.iml
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,26 @@ Expands to:
;=> 7
```

## ClojureScript

In order to use the library with [ClojureScript](https://github.com/clojure/clojurescript) we use [readers conditionals](http://clojure.org/guides/reader_conditionals).

You need to use `:require-macros` in your namespace. For example:
```clojure
;; example_ns.cljs
(ns example-ns
(:require-macros [pallet.thread-expr :as th]))
```

Also, you can use both with readers conditionals:

```clojure
;; example_ns.cljc
(ns example-ns
#?(:cljs (:require-macros [pallet.thread-expr :as th]))
#?(:clj (:require [pallet.thread-expr :as th])))
```

## Installation

thread-expr is distributed as a jar, and is available in the
Expand Down
7 changes: 4 additions & 3 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
(defproject com.palletops/thread-expr "1.3.1-SNAPSHOT"
(defproject com.palletops/thread-expr "1.4.0"
:description "Thread-expr provides macros for use within a clojure threaded
argument expressions (-> and ->>)."
:url "http://palletops.com"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.2.1"]
[org.clojure/tools.macro "0.1.1"]])

:dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/tools.macro "0.1.2"]])
3 changes: 2 additions & 1 deletion src/pallet/thread_expr.clj → src/pallet/thread_expr.cljc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns pallet.thread-expr
"Macros that can be used in an expression thread."
(:require [clojure.tools.macro :as macro]))
#?(:clj (:require [clojure.tools.macro :as macro])))


(letfn [(for- [threader arg seq-exprs body]
`(reduce #(%2 %1)
Expand Down