if-let and when-let also come in handy in a lot of those cases.
If the nils already are in a data structure, there are (filter
identity ..)and (remove
nil? ..) to remove false and/or nil values from sequences.
On associatives, there is an :or key available in the destructuring dsl: (let
[{x :foo :
Thanks!
On Wednesday, March 13, 2013 2:34:25 PM UTC-7, Michael Klishin wrote:
>
>
> 2013/3/14 Brian Craft >
>
>> Is there a common idiom for skipping blank or null values, as you might
>> do in javascript like
>> var foo = a || b || c;
>>
>
> (or a b c)
>
> false and nil evaluate to false in Cloj
There are several, depending on what exactly you want to skip. Your example
would just be
(let [foo (or a b c)] ...)
There are also some-> and cond->, which you may find useful in other
contexts.
On Wednesday, March 13, 2013 10:31:33 PM UTC+1, Brian Craft wrote:
>
> Is there a common idiom for
Is there a common idiom for skipping blank or null values, as you might do
in javascript like
var foo = a || b || c;
--
--
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
Note that posts fr