I somewhat disagree with the coding standards in certain cases. If you have
a large number of options, you may find yourself creating the option map
programmatically. In which case:
(release-sharks 2 options)
Is preferable to:
(apply release-sharks 2 (apply concat options))
- James
On 18 June 2013 06:32, dmirylenka <[email protected]> wrote:
> According, to the library coding standards, the first is better:
>
> (release-sharks 2 :laser-beams true) ; good
> (release-sharks 2 {:laser-beams true}) ; bad
>
> http://dev.clojure.org/display/design/Library+Coding+Standards
>
>
> On Tuesday, June 18, 2013 5:26:15 PM UTC+12, Omer Iqbal wrote:
>>
>> Hey folks,
>>
>> What'c considered more idiomatic when having multiple, optional arguments?
>>
>> (defn foo1 [a b & args]
>> (let [opts (apply hash-map args]
>> ...))
>>
>> or
>>
>> (defn foo2 [a b opts]
>> ...)
>>
>>
>> Cheers,
>> Omer
>>
>>
>> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.