abs function...
Howdy,
I know a while ago there was much discussion on the
best code for an abs function. I'm not sure what the
final result was, but I came up with a one-liner which
i dont think I'd seen before. Hope it's some use to
somebody. It can handle atoms, sequences and nested
sequences.
-- abs function
function abs( object x )
return sqrt( x * x )
end function
Logic: fairly simple. The square of any number is
positive.
Hope it's some help,
- Mike Fowler.
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
|
Not Categorized, Please Help
|
|