3 ms·
I didn't sign in too far, but isn't the first line of code on their landing page a typo? (define my-language 'English) Looks like it's missing a closing singl
by codazoda 6y ago
I didn't sign in too far, but isn't the first line of code on their landing page a typo?
(define my-language 'English)
Looks like it's missing a closing single quote. I suppose it could be optional.
- vvillena 6y agoStrings in Lisp are surrounded with double quotes. In this case, 'English is not a string, but a symbol. Symbols are arbitrary flags with readable names. There are lots of languages with symbols. Some of them even use the same syntax, like Scala (symbol usage in Scala is uncommon, though). However, the most prominent non-Lisp language that uses symbols all the time is probably Ruby.
- kazinator 6y agoWell, rather, english is not a string, but a symbol. Because symbols denote variable names in Lisp code, the expression english calls for the value of english. If we want the value of the expression to be the english symbol object itself, we need (quote english). Because that is too verbose for a language in which symbolic processing is prime time, there is a shorthand prefix notation for it, 'english.
- lispm 6y ago> 'English is not a string, but a symbol 'ENGLISH is not a symbol, it's actually a shorter notation for the list (QUOTE ENGLISH). But it evaluates to a symbol: ENGLISH
- thomas11 6y agoThe code is correct. That's a Lisp thing called `quote`. https://docs.racket-lang.org/guide/Pairs__Lists__and_Racket_Syntax.html#%28part._.Abbreviating_quote_with__%29 https://docs.racket-lang.org/guide/Pairs__Lists__and_Racket_...