Oh, yeah. Silly me, I *can* do that. Thanks a lot. It works like a charm now.
On Feb 8, 2:17 am, Meikel Brandmeyer <m...@kotka.de> wrote: > Hi, > > Am 08.02.2009 um 00:40 schrieb samppi: > > > > > (defn conc* [tokens & subrules] > > (loop [subrule-queue (seq subrules), remaining-tokens (seq tokens), > > products []] > > (if (nil? subrule-queue) > > [products remaining-tokens] > > (let [[subrule-products subrule-remainder :as subrule-result] > > ((first subrule-queue) remaining-tokens)] > > (when-not (nil? subrule-result) > > (recur (rest subrule-queue) subrule-remainder > > (conj products subrule-products))))))) > > (defmacro conc [& subrules] > > `(fn [tokens#] > > (conc* tokens# ~...@subrules))) > > > I had another function called factor=: > > (defn factor= [factor subrule] > > (apply conc (replicate factor arg))) > > > When I changed conc to a macro, factor= didn't work anymore. Is there > > no way of fixing factor=? > > Why don't you call conc* directly? > > (defn factor= [factor subrule] > (fn [tokens] > (apply conc* tokens (replicate factor subrule)))) > > That's another nice example why to pack as much as possible > into a function, which is then called by the expanded macro > code. > > Sincerely > Meikel > > smime.p7s > 5KViewDownload --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---