There's one important case where (coll n) is not the same as (get coll n) -
when coll is nil. In that case (get coll n) will return nil and (coll n)
will barf. I tend to use get in those cases because of this.

On 24 February 2015 at 08:50, Colin Yates <colin.ya...@gmail.com> wrote:

> A minor point (get col n) is the same as (col n).
>
> It's more of a stylistic thing, but your use of protocols and
> implementation is quite 'stateful'. I would have done the same with
> vanilla maps:
>
> (def employee [first-name last-name level]
>  {:first-name .....})
>
> (defn promote [{:keys [level] :as employee]
>   (assoc employee :level (next-item levels level)))
>
> but that is just me - maybe I ran too far from the OO world....
>
> On 23 February 2015 at 18:44, Daniel Hinojosa
> <dh.evolutionn...@gmail.com> wrote:
> > This is for my language matrix project that has samples for 10 different
> > languages.  My clojure knowledge is ok, but not really as great where I
> > would like it to be, therefore looking towards the community for help.
> >
> > This example works, but it still has the feel of a lot of duplication,
> are
> > there any refactorings that I can do to this to make it more concise?
> >
> >
> https://github.com/dhinojosa/language-matrix/blob/master/clojure/protocols/protocols.clj
> >
> > Thank you in advance,
> >
> > Danno
> >
> > --
> > 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 from new members are moderated - please be patient with
> your
> > first post.
> > 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
> > ---
> > 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 clojure+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> 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 from new members are moderated - please be patient with
> your first post.
> 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
> ---
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 from new members are moderated - please be patient with your 
first post.
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
--- 
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to