Satimage Previous | Next
Sorting, reversing, replacing values in arrays of real
Home Documentation Smile Computing Smile's maths Sorting, reversing, replacing values in arrays of real  
The following commands provide various manipulations of arrays of real.
reversearray
returns the array of real reverse of the direct parameter (like reverse of with regular AppleScript lists).
set a1 to {0.0, pi} as array of real
set a2 to reversearray a1
a2 as list of real -- {3.14159265359, 0.0}
replacemissingvalue
returns an array of real where missing value's and NAN's were replaced with the value that you specify.
set a1 to createarray 5 range {-2, 2}
set a2 to (sqrt a1)
set a3 to replacemissingvalue a2 with 0.0
a3 as list of real
-- {0.0, 0.0, 0.0, 1.0, 1.414213562373}
sortlist
sorts an array of real, or a list of arrays of real according to the order of any of them, and returns the sorted array of real or list of arrays of real.
set a to {{-2, -3, -1}, {2002, 2003, 2001}} as array of real
set b to sortlist a with respect to 2
b as list of real
-- {{-1.0, -2.0, -3.0}, {2001.0, 2002.0, 2003.0}}
Version française
Copyright ©2008 Paris, Satimage