0
(define (most-common-word str)
  (let (wordslist str-split str " ")))

I am trying to do a inner variable of lists of strings. but I get the error "bad syntax".

I looked for answers here but the things I changed, didn't help.

str-split returns a list of strings with " " the separator.

thanks.

shay C
  • 51
  • 2
  • 7

1 Answers1

3

It should look like:

(let ([word-list <VALUE>]) <BODY>)

... which establishes a local binding from word-list to the value <VALUE>. This binding is effective only inside the <BODY> form enclosed by the let.

Now, in order to compute <VALUE>, you have to call str-split with the arguments you want (i.e. str and " "). The way you perform a function call is to wrap it in parenthesis (this is valid only in a context where the form is evaluated as an expression, not where parenthesis mean binding, for example). So <VALUE> should really be:

(str-split str " ")
coredump
  • 37,664
  • 5
  • 43
  • 77