Discussion

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

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))]))
293 points Decabytes 4 years ago 284 comments

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton