12345678910111213141516171819202122232425262728293031 |
- (import (ice-9 match))
- (define odd-times-appearing
- (λ (ints)
- ;; sorting inside the function, as it is an
- ;; implementation detail of how one finds odd times
- ;; appearing numbers in a list
- (let ([sorted (sort ints <)])
- (match sorted
- [() (error "no odd times appearing numbers in the given list")]
- [(a) a]
- [(a a rest ...) (odd-times-appearing rest)]
- [(a b rest ...) a]))))
- (odd-times-appearing '(1 7 1 7 3 7 3))
- (import (ice-9 match))
- (define (odd-times-appearing ints)
- (let ([sorted (sort ints <)])
- (match sorted
- [() (error "no odd times appearing numbers in the given list")]
- [(a) a]
- [(a a rest ...) (odd-times-appearing rest)]
- [(a b rest ...) a])))
- (odd-times-appearing '(1 7 1 7 3 7 3))
|