Reputation: 1
I am trying to animate a word letter by letter using Beginner Student Language on Racket. However, this code gives me an error "function call: expected a function after the open parenthesis, but found a part". I bolded the part that is giving me problems. Any suggestions?
(define theWord "blahlahblahblahblahbla")
(define (letterByLetter a)
(overlay ((substring theWord 0 a) 50 "red") (empty-scene 500 500)))
(animate letterByLetter)
Upvotes: 0
Views: 291
Reputation: 214
This is because overlay takes two or more images as arguments. It looks like you want the first argument to be a call to text so the form should be
(text substring theWord 0 a)
However, note that animate will call letterByLetter
28 times a second in an infinite loop so will run out of letters and raise an exception! Perhaps you could compare a
and (string-length theWord)
...
Upvotes: 1