Variable parameter synonym functions

Mike Kerner MikeKerner at roadrunner.com
Thu Oct 23 09:34:38 EDT 2014


Yes, I understand how to do it, I'm just wondering if there's a more
elegant way.

On Thu, Oct 23, 2014 at 8:29 AM, Mark Schonewille <
m.schonewille at economy-x-talk.com> wrote:

> Hi Mikey,
>
> Here's a way:
>
> on mouseUp
>      put fun1("a","b")
> end mouseUp
>
> function fun1
>      repeat with x = 1 to the paramcount
>           put param(x) & comma after myList
>      end repeat
>      put "fun2(" & char 1 to -2 of myList & ")" into myFun
>      return value(myFun)
> end fun1
>
> function fun2
>      return the paramcount
> end fun2
>
> --
> Best regards,
>
> Mark Schonewille
>
> Economy-x-Talk Consulting and Software Engineering
> Homepage: http://economy-x-talk.com
> Twitter: http://twitter.com/xtalkprogrammer
> KvK: 50277553
>
> Installer Maker for LiveCode:
> http://qery.us/468
>
> Buy my new book "Programming LiveCode for the Real Beginner"
> http://qery.us/3fi
>
> LiveCode on Facebook:
> https://www.facebook.com/groups/runrev/
>
>
> On 10/23/2014 13:51, Mikey wrote:
>
>> Has anybody come up with an easy way to write functions or handlers that
>> are synonyms for other functions/handlers where both take a variable number
>> of parameters?
>>
>> If I want to have a handler "a" and synonym "aardvark", I would normally
>> write
>>
>> on a name
>>     aardvark name
>> end a
>>
>> on aardvark name
>>     answer "I'm an aardvark named"&&name
>> end aardvark
>>
>>
>> Now imagine doing that while supporting a variable number of parameters.
>>
>> Sent from my iPhone
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."



More information about the use-livecode mailing list