Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added truthy as synonym for identity, for use in clause :is truthy

  • Loading branch information...
commit 36f399745d3c12ddca84d86e578911b563853abe 1 parent 655473d
Evan Gamble authored
Showing with 12 additions and 3 deletions.
  1. +8 −2 README.markdown
  2. +1 −1  project.clj
  3. +3 −0  src/let_else.clj
View
10 README.markdown
@@ -139,7 +139,9 @@ is equivalent to:
The keyword clause `:else nil` with no other keyword clauses is equivalent to `when-let`.
Some people find `:else nil` awkward, since nil is already the value of `when-let` when
-the binding value is falsey. An equivalent keyword clause is `:is identity`.
+the binding value is falsey. An equivalent keyword clause is `:is truthy`.
+`let-else/truthy` is defined as a synonym of `clojure.core/identity`.
+
A not-quite-equivalent keyword clause is `:is-not nil?`, which distinguishes between nil
and not-nil rather than falsey and truthy.
@@ -157,4 +159,8 @@ Fixed the behavior of `:else` _falsey_ which was incorrectly being ignored.
* Added the new keyword clause `:is-not` _pred_.
* Changed the behavior of `:else` _else_ in the presence of `:when`, `:is`, or `:is-not` so that _else_ is evaluated inside the context of the binding. `:else` without other keyword clauses is still evaluated outside the binding context.
-* `:delay` is now ignored when other keyword clauses are present.
+* `:delay` is now ignored when other keyword clauses are present.
+
+#### Version 1.0.4
+
+Defined `truthy` as a synonym of `identity`, for use in the clause `:is truthy`.
View
2  project.clj
@@ -1,4 +1,4 @@
-(defproject egamble/let-else "1.0.3"
+(defproject egamble/let-else "1.0.4"
:description "Macro let? with :when, :is, :is-not, :else and :delay clauses in the bindings."
:dependencies [[org.clojure/clojure "1.3.0"]
[useful "0.7.10"]]
View
3  src/let_else.clj
@@ -123,3 +123,6 @@
`(do ~@body)
(reverse sections))))
+(def truthy
+ "Synonym for identity. In a let? form, :is truthy is clearer than :is identity."
+ identity)
Please sign in to comment.
Something went wrong with that request. Please try again.