Skip to content

Instantly share code, notes, and snippets.

@tonetheman
Created December 13, 2019 22:28
Show Gist options
  • Save tonetheman/8e4c273533292d812ad5d44d1e8db784 to your computer and use it in GitHub Desktop.
Save tonetheman/8e4c273533292d812ad5d44d1e8db784 to your computer and use it in GitHub Desktop.
collatz in racket
#lang racket
(define (foo n)
(if (= (modulo n 2) 0)
(/ n 2)
(+ (* 3 n) 1)
))
(define (goo a)
(println a)
(if (= (first a) 4)
a
(goo (cons (foo (first a)) a))
)
)
(goo (list 100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment