> This really just reinforces what others have already said above that > Clojure's standard library doesn't make it easy for you to do something > inefficient >
Do you at least agree it is at least debatable whether an intro class might benefit from avoiding efficiency concerns initially? I incorrectly assumed that that would require macros, but, it really only requires beginner friendly regular functions. For example, see this... (defn comb [& args] (let [comb_ (apply concat args) first_ (first args)] (cond (list? first_) comb_ (vector? first_) (into [] comb_) (map? first_) (into {} comb_) (set? first_) (into #{} comb_) (string? first_) (apply str comb_)))) Testing with these... (prn (comb [1 2] [3 4])) (prn (comb [1] [2 3])) (prn (comb [1 2] [3])) (prn (comb '(1 2) '(3 4))) (prn (comb '(1) '(2 3))) (prn (comb '(1 2) '(3))) (prn (comb #{1 2} #{3 4})) (prn (comb #{1} #{2 3})) (prn (comb #{1 2} #{3})) (prn (comb [1 2] [3 4] '(5 6))) (prn (comb '(1 2) '(3 4) [5 6])) (prn (comb {"a" "b", "c" "d"} {"e" "f", "g" "h"})) Gives these... [1 2 3 4] [1 2 3] [1 2 3] (1 2 3 4) (1 2 3) (1 2 3) #{1 4 3 2} #{1 3 2} #{1 3 2} [1 2 3 4 5 6] (1 2 3 4 5 6) {"a" "b", "c" "d", "e" "f", "g" "h"} {"a" "b", "c" "d", "e" "f"} {"a" "b", "c" "d", "e" "f"} "abcdefghi" Notice that with my comb (combine) function, I eliminated the need for str, prepend, append, conj, etc. Furthermore, comb gives the intuitive answer irrespective of efficiency. Is that so bad at least temporarily? cs -- 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.