;; Examples of errors ;; what's the problem? ;; when is it detected? Two types of error: ;; syntax error (detected before the program runs) ;; run-time errors (detected when an attempt to execute ;; an operation fails. ;; When there is a syntax error, the evaluation is ;; not attepmpted. Run-time error means that the evaluation ;; is attempted and fails. (+ (2 3)) ; syntax error: 2 is a number, not a function name ;(2 sqrt) ; syntax error: 2 is a number, not a function name ;(srt 2) ; syntax error: unknown function srt ;(/ 2 0) ; run-time error: division by 0 ;(/ 2 (- 5 (/ 10 2))) ; run-time error: division by 0 ;(define (f n) (n n)) ; syntax error at Beginner Student level: unknown function name n ;(define (f n) (/ n (- n n))) ; this definition is syntactically correct. The function is not applied so its body is not executed ;(f 4) ; run-time error when the function is applied ;(f 2.5) ; run-time error when the function is applied ;(define (add7 n) (+ n 7)) ; correct definition ;(add7 "Hi there!") ; run-time error when + is applied to a string