Re: Question involving scope/recursion/arguments
- To: mathgroup at smc.vnet.net
- Subject: [mg27649] Re: Question involving scope/recursion/arguments
- From: "Paul Lutus" <nospam at nosite.com>
- Date: Sat, 10 Mar 2001 00:49:39 -0500 (EST)
- References: <98a224$cri@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"John Eric Hanson" <jhanson1 at stny.rr.com> wrote in message news:98a224$cri at smc.vnet.net... > Hello all- > > 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). > > Any hints would be appreciated. Well, you don't specify what you want to do, so I can only offer this generic advice: f[list_,a_,b_] := (g[list], If[r, list = f[list_,c,d], STOP]) Or you can make the list global, not a passed argument. -- Paul Lutus www.arachnoid.com