Math problem

Joe Lewis Wilkins pepetoo at cox.net
Sat Feb 18 20:50:56 EST 2012


You're forgiven, Peter.

Joe Wilkins
Architect

On Feb 18, 2012, at 5:41 PM, Peter M. Brigham, MD wrote:

> I picked this trick up from someone along the way, on this list I believe, I've lost track of where it came from, so credit goes to someone else. You're right, Joe, commenting something as opaque as this (at least at first glance) is advisable, especially when you're sharing code. I can only plead that I wrote this at 11:30 PM after a 15 hour working day, so I was focusing only on getting it right, not on explaining it.
> 
> Long live the use-LC list!
> 
> -- Peter
> 
> Peter M. Brigham
> pmbrig at gmail.com
> http://home.comcast.net/~pmbrig
> 
> On Feb 18, 2012, at 12:23 PM, Joe Lewis Wilkins wrote:
> 
>> True Ken, but w/o comment it is much more difficult to know what is going on. If you're going to use one liners like this, you'd better add some commentary. One of the weaknesses I see in LC coding is the shortage of comments. I realize that is a strong-point of LC; it is "almost" self-commenting, but... 
>> 
>> 
>> IMHO,
>> 
>> Joe Wilkins
>> 
>> On Feb 18, 2012, at 9:01 AM, Ken Ray wrote:
>> 
>>>> function roundUp x
>>>> return trunc(x) + char itemoffset((x mod 1 > 0),"true,false") of "10"
>>>> end roundUp
>>> 
>>> VERY clever, Peter!
>>> 
>>> That's a great one-line variant to:
>>> 
>>> function roundUp x
>>> put trunc(x) into tRetVal
>>> if x mod 1 > 0 then add 1 to tRetVal
>>> return tRetVal
>>> end roundUp
>>> 
>>> :D
>>> 
>>> Ken Ray
>>> Sons of Thunder Software, Inc.
>>> Email: kray at sonsothunder.com
>>> Web Site: http://www.sonsothunder.com/	





More information about the use-livecode mailing list