Question: Why am I getting this error string - trim: undefined; cannot reference an identifier before its definition? ( define ( valid - whoozit? s )

Why am I getting this error "string-trim: undefined;
cannot reference an identifier before its definition"?
(define (valid-whoozit? s)
(and (=(string-ref s 0) #\x)
(>(string-length s)1)
(string-contains s "y")))
(define (valid-whatzit? s)
(and (=(string-ref s 0) #\q)
(>(string-length s)2)
(or (string-contains s "z")
(string-contains s "d"))
(valid-blurb? (substring s 2))))
(define (valid-blurb? s)
(cond ((string-empty? s) #t)
((valid-whoozit? s)
(valid-blurb? (substring s (string-length (match0))))))
((valid-whatzit? s)
(valid-blurb? (substring s (string-length (match0))))))
(define (main)
(display "Enter an alien word: ")
(let loop ()
(let ((input (string-trim (read))))
(if (valid-blurb? input)
(display "The word is fine.")
(begin
(display "The word is a mess!")
(newline)
(loop))))))
(main)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!