Here's one, I'm setting basedir to either :basedir in a map in *locs
(a thread-local var) or to "." if :basedir was not found in the map...

(let [basedir (if-let [bdir (:basedir *locs)] bdir ".")]
    ...)

i.e bdir assumes the value of the test and if that is not false (or
nil) returns it otherwise the else part.


On Sun, Feb 8, 2009 at 4:25 PM, Mark Volkmann <r.mark.volkm...@gmail.com> wrote:
>
> Can someone show me an example of a good use of if-let?
>
> I find its doc string a little confusing. It says "If test is true,
> evaluates then with binding-form bound to the value of test, if not,
> yields else". However, it doesn't have a parameter named "test". I
> assume it means "If the binding evaluates to true ...".
>
> Also, it has a parameter named "bindings", but it should perhaps be
> named "binding" because it doesn't allow specifying more than one
> binding.
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to