Or, you could just write foo as

;;Adjusting for 2d
(defmacro foo
  [vec-vec-of-symbols]
  (let [vec-vec-of-str (vec (map (comp vec (partial map str)) vec-vec-
of-symbols))]
  `(foo* ~vec-vec-of-str)))

This let you write foo* to handle strings.  Anyway, the key thing to
note in both examples is that the heavy lifting is delegated to
another function.  This is an element of good macro design.

Just my $.02


On Oct 22, 10:29 am, Meikel Brandmeyer <m...@kotka.de> wrote:
> Hi,
>
> On Oct 22, 4:22 pm, Tzach <tzach.livya...@gmail.com> wrote:
>
> > I’m writing a small facility which get vector of vectors of names
> > (strings) and print them in a special format.
> > Something like (foo [[“aname” “a-different-name”] [ “oneMoreName”]])
> > This works fine, but make it hard to write all the quotations when
> > many parameters are used.
>
> > What is the simplest way to define foo as
> > (foo [[aname a-different-name ] [oneMoreName]]) ?
>
> > Is  macro required? (I guess it is)
>
> It is, but a simple one. Rename your foo function to foo* and create a
> simple macro called foo like that:
>
> (defmacro foo
>   [vec-of-symbols]
>   `(foo* (quote ~vec-of-symbols)))
>
> There you go. (Of course you must now handle Symbols in your foo* star
> function instead of Strings...)
>
> Sincerely
> Meikel
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to