Macros aren't the right tool for that.

If you want to create a function that behaves differently, depending on the 
input (Vector, seq or something else, like LinkedHashSet)
you should look into multimethods.

And if you want to do comprehensive data manipulation you should look 
into https://github.com/nathanmarz/specter .

Am Montag, 16. Juli 2018 22:21:02 UTC+2 schrieb Christian Seberino:
>
> I'm impressed with Clojure syntax and I'm still a beginner.
>
> I noticed conj behaves differently for lists and vectors.  I also noticed 
> cons does not return a vector for a vector input.
>
> Is there any downside to make 2 macros...prepend and append that behave 
> the same for lists and vectors, and also,
> return same types as inputs?
>
> If I'm not mistaken, I believe it is for performance reasons that these 
> are not already in the standard language?
> For those that care about performance, it would be beholden on them to 
> pick the correct macro for their
> specific data structure.
>
> Good idea?
>
> Thanks!
>
> Chris
>
>
>

-- 
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