MHN

Ask HN: What piece of code/codebase blew your mind when you saw it?

293 points by Decabytes·1490 days ago·Show in HN

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)

  (cond


    [(zero? x) #f]


    [else (even? (sub1 x))]))

(define (even? x)

  (cond


    [(zero? x) #t]


    [else (odd? (sub1 x))]))
Add a comment on Hacker News →
0 of 284 comments