I'm just a Clojure beginner but it seems that the Lisp Way(TM) is to append
and prepend one or more elements
with a single command if possible. The logical name for this command seems
to be concat which led to this..
(defn concat_ [a b]
(def c (concat a b))
(if (vector? a)
(into [] c)
c))
(concat_ [1 2] [3 4]) => [1 2 3 4]
(concat_ '(1 2) '(3 4)) => (1 2 3 4)
(concat_ [1] [2 3]) => [1 2 3]
Lists return lists and vectors return vectors. Simple.
Yes yes I know it is slow. I also know I need to expand concat_ to handle
other data structures.
In my little newbie world, this "feels" like the ultimate "right" solution.
Chris
--
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.