recursive action
- To: mathgroup at smc.vnet.net
 - Subject: [mg125326] recursive action
 - From: Luis Valero <lvalerob at mac.com>
 - Date: Tue, 6 Mar 2012 06:01:56 -0500 (EST)
 - Delivered-to: l-mathgroup@mail-archive0.wolfram.com
 
Dear Sirs,
I want to associate the run of a recursive function:	 list=action[list]  	to a Trigger Control.
The intial list is an Array 2xn (where n is an integer), for example: 	 initial=Array[{RandomInteger[-5,5],RandomInteger[-5,5]}&,n]   
and the action Maps a function to each element of the list. 
I try with this example (where de action is simplified):
initial := Array[{RandomInteger[{-5, 5}], RandomInteger[{-5, 5}]} &, 5];
function := (RandomReal[{-1, 1}] + #) &;
state[t_] := If[t > 0, function /@ prev, initial];
Manipulate[
 Text[#[[{1, 2}]] & /@ (prev = state[p])],
 {{p, 0, " "}, 0, Infinity,  ControlType -> Trigger},
 TrackedSymbols -> {p}, SaveDefinitions -> True]
but doesn't work correctly.