Logo

Programming-Idioms

History of Idiom 53 > diff from v44 to v45

Edit summary for version 45 by Dodopod:
New Scheme implementation by user [Dodopod]

Version 44

2017-05-27, 17:13:05

Version 45

2017-06-07, 15:59:40

Idiom #53 Join a list of strings

Concatenate elements of string list x joined by the separator ", " to create a single string y.

Illustration

Idiom #53 Join a list of strings

Concatenate elements of string list x joined by the separator ", " to create a single string y.

Illustration
Code
(define y
  (foldr (lambda (a b)
           (if (string=? b "")
               a
               (string-append a ", " b)))
         ""
         x))