Mine was when I learned a subset of recursion called mutual recursion. It was for a pair of function to determine if a number was odd or even.
(define (odd? x)
(define (even? x)
Comments URL: https://news.ycombinator.com/item?id=33413124
Points: 10
# Comments: 0
Continue reading...
(define (odd? x)
Code:
(cond
[(zero? x) #f]
[else (even? (sub1 x))]))
Code:
(cond
[(zero? x) #t]
[else (odd? (sub1 x))]))
Comments URL: https://news.ycombinator.com/item?id=33413124
Points: 10
# Comments: 0
Continue reading...