I want to write a code in DrRacket that accepts a multiple words from the command prompt and does converts them to a list of string. For eg. if I enter hello how do you do in the prompt, it should convert it into a list ‘(“hello” “how” “do” “you” “do”). Is it possible in DrRacket?
i tried this:
(define inp-lst (read))
On running this code, an input bar is shown in the command promt. but when i enter the above line, the value of inp-lst turns out to be just ‘hello. Can someone help?
As a first step, type your input between quotes, like this:
Now, you can create a list of strings doing this:
EDIT :
As has been pointed out in the comments,
read-linemight be a better alternative:Using
read-line, you don’t need to surround the typed text with quotes.