How would one convert the following procedural logic into functional/Clojure? x = expensive-calculation return (f1(x), f2(x), f3(x))
I'm sure I could force it by using a var to save the intermediate value, but that's still procedural. It seems like the pattern of reusing an expensive result in multiple function calls without recalculating it must have a functional approach, but I'm not finding it. What I really want to do is to return: {:key1 f1(f0(x)), :key2 f2(f0(x)), :key3 f3(f0(x))} without paying the price of executing f0 multiple times. Tnx. -- 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.