A lot of people have made good suggestions, but I think you're looking
for first class functions:
http://en.wikipedia.org/wiki/First-class_function
They're common in functional languages, rare in procedural languages.
In particular you're looking for what is commonly called the map
function:
http://en.wikipedia.org/wiki/Map_(higher-order_function)
That would allow something like this:
function map f,aList -- takes a function and a list, and returns the
list with the function applied to each element
put empty into returnList
repeat for each item i in aList
put f(i) & comma after returnList
end repeat
return char 1 to -2 of tReturn
end map
This is territory into which Revolution (and xTalks in general)
ventures unwillingly and ungracefully. In particular the fact that
there is no nice way to handle arbitrarily nested lists stands as a
nasty roadblock here. Nested arrays might be an answer but I haven't
thought it through.
regards,
Geoff
On Jan 15, 2009, at 11:45 AM, Scott Rossi wrote:
Hi List:
Just curious... Is there any way to construct a function using a name
stored in a variable without resorting to "do"? For example:
on mouseUp
put "hello" into pData1
put "world" into pData2
put "shout" into test
do "answer" && test & "(pData1,pData2)"
end mouseUp
function shout pData1,pData2
return pData1 && pData2
end shout
Can the last line of the mouseUp handler be written without "do"?
I'm not
against using "do", just wondering if there's another option.
Thanks & Regards,
Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution