1234567891011121314151617181920212223242526272829 |
- (library (math)
- (export sum
- product
- divisible-by?
- n-highest)
- (import
- (except (rnrs base) let-values map error)
- (only (guile)
- lambda* λ
- remainder
- sort)
- (srfi srfi-1))
- (define sum
- (λ (lst)
- (apply + lst)))
- (define product
- (λ (lst)
- (apply * lst)))
- (define divisible-by?
- (λ (num divisor)
- (= (remainder num divisor) 0)))
- (define n-highest
- (λ (lst n)
- (take (sort lst >) n))))
|