to mean_angle :angles local "avgsin make "avgsin quotient apply "sum map "sin :angles count :angles local "avgcos make "avgcos quotient apply "sum map "cos :angles count :angles output (arctan :avgcos :avgsin) end foreach [[350 10] [90 180 270 360] [10 20 30]] [ print (sentence [The average of \(] ? [\) is] (mean_angle ?)) ] bye