Passing a file name as an argument but working on the file itself looks a lot like using a global variable - which would violate the strict functional paradigm. I notice the article you cited talks about updating a database by passing the database as an argument - not just a reference to the database.
My ignorance about monads continues unscathed. On Thu, Jan 21, 2010 at 1:35 PM, Dan Bron <[email protected]> wrote: > I wrote: > > My current understanding is along the lines Raul quoted: that is, a > monad > > is a way to package up "the state of the world" as an > > input > > Devon responded: > > This seems no different than strict functional programming (dis-allowing > > globals). > > Not quite, though I agree the effects are the same (this is what Raul was > getting at). In strict functional programming you can > pass in, e.g., a filename. The outputs of such a strict functional program > can differ from invocation to invocation (as the > contents of the file change), even though the nominal input is unchanged: > this is anathema to strict functional programming. > Monads are a way to solve this problem (but knowing your pragmatic bent, I > should probably have scare-quoted "solve" and "problem" > :). > > ... > -- Devon McCormick, CFA ^me^ at acm. org is my preferred e-mail ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
