// Dedicated to the public domain by Christopher Diggins // This file is free to be used, modified or redistributed for any purpose, // without restriction, obligation or warantee. // http://www.cdiggins.com //============================================================================== // Vector functions define vec_sum : (list -> any) {{ desc: Computes the sum of elements in a vector. test: in: [0 1 2] list vec_sum out: 3 tags: level1,vectors }} { 0 [+] fold } define vec_scale : (list any -> list) {{ desc: Multiplies all items in a vector by a scalar value. test: in: [0 1 2] list 2 vec_scale out: [0 2 4] list tags: level1,vectors }} { [*] papply map } define vec_slide : (list any -> list) {{ desc: Adds a value to all items in a vector. test: in: [0 1 2] list 2 vec_slide out: [2 3 4] list tags: level1,vectors }} { [+] papply map }