Finished Racket version, tidied up F#