Scheme (Racket) how to return a string in a list without quotation

Viewed 43

I’m trying to return a list of strings.

I am using (list “stringA” “stringB”)

And it is returning “string A” “stringB”

Is there anyway it can return stringA stringB?

1 Answers

There are different ways of making a list. Some basic lists are:

(f x y)     ; run function f, substitute values x and y
(list x y)  ; create list, substitute values x and y
'(x y)      ; create list, don't substitute x and y

(quote x y) ; Common Lisp alternative of '(x y)

If you go for (list stringA stringB) then Scheme will try to replace stringA stringB with their values.

What you want is '(stringA stringB)

Related