Re: Local iterator
- To: mathgroup at smc.vnet.net
- Subject: [mg29384] Re: [mg29361] Local iterator
- From: BobHanlon at aol.com
- Date: Sat, 16 Jun 2001 02:47:55 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 2001/6/15 2:39:43 AM, vvasta at btinternet.com writes: >I would like to write a function like Table, or Do, that takes an iterator >and invokes a specified function for each value in the iterator interval, >I >could write something working without iterator: > >SetAttributes[myfun,HoldAll]; >myfun[fun_, it_, vmin_, vmax_] := Block[{it}, > For[it = vmin, it <= vmax, ++it, Print[fun]] > ] > >myfun[N[Log[x]],x,1,10] > > >How can I write a function like myfun[f,{i,mix,max,step}] ? > What exactly do you want the function to do that cannot be done directly with Table? Table[Log[x], {x, 1., 9., 2.}]//TableForm Table[{x, N[Log[x]]}, {x, 1, 9, 2}]//TableForm Bob Hanlon Chantilly, VA USA