I think I see what you're saying. But honestly my goal isn't to replicate the OO experience. My goal is to replicate how easy OO made this specific scenario. In other words I want to use Clojure properly and trying to paste an OO framework on Clojure has got to be a major anti-pattern. I'm just trying to figure out what the right pattern is because the fact that I'm forced to make the derived values into thunks feels really wrong but I honestly don't know what's right in the context of Clojure.
On Feb 17, 10:39 am, CuppoJava <patrickli_2...@hotmail.com> wrote: > HiYaron, > > You've slightly misunderstood my suggestion. I hope this will shed > some reasoning on it: > > In OO, what you are effectively doing is this: > > The Object represents the "environment" under which you do your > calculations. > The "environment" object is created by your constructor. > Once this "environment" has been created, you can use it to do > calculations using "foo.tax_deductible_expenses(1)". > > My example is meant to capture this style of programming. (Whether > this style is appropriate is up to you to decide.) > > The "environment" is represented by a map. > You can write a function that creates an "environment" just like how > you can write a constructor to create an environment object in Java. > eg. new-environment( ... ) > Once this environment has been created, you may use it to do > calculations using > "(in-environment foo > (tax-deductible-expenses 1))" > > The in-environment macro is not meant to contain any logic. It is > solely meant to save you some typing. > > Hope that's more clear. > -Patrick -- 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