Re: Question involving scope/recursion/arguments
- To: mathgroup at smc.vnet.net
- Subject: [mg27662] Re: [mg27642] Question involving scope/recursion/arguments
- From: BobHanlon at aol.com
- Date: Sat, 10 Mar 2001 00:49:51 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
f[list_,a_,b_] := Module[{t = g[list]}, If[r, f[t,c,d], t]] It is unclear to me whether the STOP result to be the last value of g[list] (as shown) or the last value of list. If the latter, use f[list_,a_,b_] := Module[{t = g[list]}, If[r, f[t,c,d], list]] Bob Hanlon In a message dated 2001/3/9 2:53:03 AM, jhanson1 at stny.rr.com writes: >Having a bit of difficulty here. In general terms, the problem is this: > >I would like to have a function f that takes a list (among other things) >as >an argument. I would then like to make some adjustments to the list and >then call f again (from inside the first f), and so on until the list >satisfies a certain criteria. The general template would look something >like this: > >f[list_,a_,b_] := (g[list], If[r, f[list_,c,d], STOP]) > >I can accomplish my intended task using a global variable for list (or >assigning list to a global), but I haven't succeded yet to maintain the >values when I simply want to recursively make adjustments to list without >introducing a copy of it (or fixing the function to a specific variable). >