Capture the Trig Function from an Option Menu Button

Jim Hurley jhurley0305 at sbcglobal.net
Sun Dec 9 15:36:07 EST 2012


Well, Mark, maybe not so flexible. For example, to use Do with the arctan() function in LC, as you suggest, would require  you to replace the arctan text with atan text,  or more likely the atan2 text, as that is how LC expresses that trig funciton. 

That might not be easy if arctan text exists in more than one place. A bit of parsing may be required. 

And Do can be a bit slow. From the dictionary: "Using the do command is slower than directly executing the commands, because each statement must be compiled every time the do command is executed." 

As to simplifying, it appeared that a good bit of the thread revolved around a certain level of opacity in the Do statement. 

But there is certainly a nice generic quality to Do. "Never mind what, just Do it."

In many cases it will boil down to taste, and I will grant you that that is no small issue. It is a good part of what makes coding satisfying.

Jim



> 
> Jim-
> 
> Saturday, December 8, 2012, 10:11:31 AM, you wrote:
> 
>> But could you tell me how this "mouseUP" handle fails to do the job?
> 
> Well, it's not nearly as hard to read, for one thing. But seriously,
> the use of lambda functions (google it) can provide a degree of
> flexibility in code and help prevent coding errors. For instance, to
> add the arctan() to your example you'd have to add a new line to the
> option control, then add a new case statement to the switch construct
> in the mouseUp handler. Possibly you could make a mistake when cutting
> and pasting, forgetting to insert a break statement, etc. Using the
> redirected form all you'd need to do is add the new line to the option
> control.
> 
> -- 
> -Mark Wieder
> mwieder at ahsoftware.net





More information about the use-livecode mailing list