Sorry... "apply" works just fine.
On Sep 28, 9:04 am, Paul Henning <p...@cybermesa.com> wrote:
> I keep running into the situation where I would call functions of the
> form (fn [ & rest] ...) with data that I have built up in a sequence,
> and can't figure out how to do it. My current instance of this is
> wanting to call clojure.contrib.combinatorics/cartesian-product on a
> list of lists of items. For example, I want:
>
> (def k '((a b) (1 2))
> (cartesian-product k)
>
> to produce the same result as
>
> (cartesian-product '(a b) '(1 2))
>
> This seems like an operation that should be common, but I just can't
> find it. I did try a quick macro like:
>
> (defmacro unapply [f as] `(~f ~...@as))
>
> But then I can't figure out how to get ~@ to apply to the value of
> "as" or how to quote the individual elements of the spliced unquote.
>
> Any help would be appreciated.
>
> Thanks,
> Paul Henning
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---