Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add "where" macro. #24

Closed
wants to merge 1 commit into from

1 participant

@myguidingstar

Synonym of let. Use with ->> to provide binding after expressions (Haskell binding style)

Hoang Minh Thang Add where macro.
Synonym of let. Use with ->> to provide binding after expressions (Haskell binding style)
17f43bc
@Tirael90 Tirael90 referenced this pull request in clojure-android/clojure
Closed

Android 5.0 - L #3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 7, 2012
  1. Add where macro.

    Hoang Minh Thang authored
    Synonym of let. Use with ->> to provide binding after expressions (Haskell binding style)
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/clj/clojure/core.clj
View
9 src/clj/clojure/core.clj
@@ -1549,6 +1549,15 @@
(list form x)))
([x form & more] `(->> (->> ~x ~form) ~@more)))
+(defmacro where
+ "Synonym of let. Use with ->> to provide binding after expressions (Haskell binding style)
+ Example:
+ (->> (+ x y) (where [x 3 y 2]))
+ which would expand to:
+ (let* [x 3 y 2] (+ x y))"
+ {:added "1.5"}
+ [& body] `(let ~@body))
+
(def map)
(defn ^:private check-valid-options
Something went wrong with that request. Please try again.