How can I use concatenation in scheme without spaces


Solution 1

append returns a list, and the evaluator prints the result like (a b c), where spaces are inserted to make the representation clear. If you need %procedure:+%, you may create a new symbol or use strings instead of symbols.

Solution 2

You're trying to use symbols, which aren't the same thing as strings in Scheme. If you want to have control over your printed output, you should use strings, which are arrays of characters.

> (append '(hello) '(world))
(hello world)
> (string-append "hello " "world")
"hello world"
> (symbol->string 'hello)
> (apply string-append (map symbol->string '(a b c d e f g)))
jacky brown
Author by

jacky brown

Updated on June 05, 2022


  • jacky brown
    jacky brown 7 months

    I have a problem with concatenation and spaces in Scheme. The result of the command:

    (append '(%procedure:) (list '+) '(%))**     //with spaces


    %procedure: + %      //without spaces

    How can I make the same result without space between the lists, so the result will be:

    • John Clements
      John Clements about 11 years
      Are you trying to produce a symbol, a string, or something else?