Update 8.rkt

Added error checking and test cases