On 23 August 2017 at 05:15, Timothy Baldridge <[email protected]> wrote:
> Simple: because failing to put it in a map constrains future growth.
>
Sometimes that's what you want. A constrained function is a simple function.
Should (find {:a 1} :a) produce {:key :a, :val 1} instead of [:a 1]? No,
because it doesn't need to be extensible.
And for that matter, where do we stop? Should:
{:person/score 89}
Be:
{:person/score {:val 89}}
Just in case we want to extend it in future?
{:person/score {:val 89, :max 100}}
Any argument about extensibility around [[k v]] also applies to {k v}.
But I guess I'd flip it around. Why would I ever want:
>
> [:response val]
>
> when I could have
>
> {:status :response
> :result val}
>
Well, going purely by syntax, it's more concise, (IMO) more readable,
easier to match and destruct, and intrinsically compatible with "into" like
functions:
(def latest-values (async/into {} ch))
I don't see how you can say {k v} is somehow fine, but a stream of [k v]
pairs over time is somehow bad.
--
James Reeves
booleanknot.com
--
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/d/optout.