git @ Cat's Eye Technologies
Define arithmetic functions with functions. Chris Pressey 1 year, 5 months ago
5 changed file(s) with 43 addition(s) and 48 deletion(s).
 16 16 `abs` expects exactly one numeric argument. 17 17 18 18 | (abs) 19 ? abort (illegal-arguments ()) 19 ? abort (illegal-arguments 20 20 21 21 | (abs 14 23) 22 ? abort (illegal-arguments (14 23)) 22 ? abort (illegal-arguments 23 23 24 24 | (abs #t) 25 25 ? abort (expected-number #t) 26 26 27 27 '<
 10 10 `add` expects exactly two arguments. 11 11 12 12 | (add 14) 13 ? abort (illegal-arguments (14)) 13 ? abort (illegal-arguments 14 14 15 15 | (add 6 7 7) 16 ? abort (illegal-arguments (6 7 7)) 16 ? abort (illegal-arguments 17 17 18 18 Both of the arguments to `add` must be numbers. 19 19 25 25 26 26 '<
 32 32 `divide` expects exactly two arguments, both numbers. 33 33 34 34 | (divide 14) 35 ? abort (illegal-arguments (14)) 35 ? abort (illegal-arguments 36 36 37 37 | (divide 14 23 57) 38 ? abort (illegal-arguments (14 23 57)) 38 ? abort (illegal-arguments 39 39 40 40 | (divide 14 #t) 41 41 ? abort (expected-number #t) 45 45 46 46 '<
 4 4 `multiply` evaluates both of its arguments to numbers and evaluates to the product 5 5 of those two numbers. 6 6 7 | (multiply 6 7) 7 | (multiply 6 7) 8 8 = 42 9 9 10 | (multiply (subtract 0 6) 7) 10 | (multiply (subtract 0 6) 7) 11 11 = -42 12 12 13 | (multiply 6 (subtract 0 7)) 13 | (multiply 6 (subtract 0 7)) 14 14 = -42 15 15 16 | (multiply (subtract 0 6) (subtract 0 7)) 16 | (multiply (subtract 0 6) (subtract 0 7)) 17 17 = 42 18 18 19 19 `multiply` expects exactly two arguments. 20 20 21 | (multiply 14) 22 ? abort (illegal-arguments (14)) 21 | (multiply 14) 22 ? abort (illegal-arguments 23 23 24 | (multiply 6 7 7) 25 ? abort (illegal-arguments (6 7 7)) 24 | (multiply 6 7 7) 25 ? abort (illegal-arguments 26 26 27 27 Both of the arguments to `multiply` must be numbers. 28 28 29 | (multiply 14 #t) 29 | (multiply 14 #t) 30 30 ? abort (expected-number #t) 31 31 32 | (multiply #t 51) 32 | (multiply #t 51) 33 33 ? abort (expected-number #t) 34 34 35 35 '<
 33 33 `remainder` expects exactly two arguments, both numbers. 34 34 35 35 | (remainder 14) 36 ? abort (illegal-arguments (14)) 36 ? abort (illegal-arguments 37 37 38 38 | (remainder 14 23 57) 39 ? abort (illegal-arguments (14 23 57)) 39 ? abort (illegal-arguments 40 40 41 41 | (remainder 14 #t) 42 42 ? abort (expected-number #t) 46 46 47 47 '<