Play audio slide show -- Keyboard shortcut: 'x'  Lecture overview -- Keyboard shortcut: 'u'  Previous page: Example of recursion: <kbd>number-interval</kbd> -- Keyboard shortcut: 'p'  Next page: Examples with recursion: <kbd>string-of-char-list?</kbd> -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Alphabetic index  Help page about these notes  Course home      Name binding, Recursion, Iteration, and Continuations - slide 22 : 42

Examples of recursion: string-merge
The function string-merge zips two lists of strings to a single string. The lists are not necessarily of equal lengths
(define (string-merge str-list-1 str-list-2)
 (cond ((null? str-list-1) (apply string-append str-list-2))
       ((null? str-list-2) (apply string-append str-list-1))
       (else (string-append
              (car str-list-1) (car str-list-2)
              (string-merge (cdr str-list-1) (cdr str-list-2))))))
An application of string-merge which converts a list of strings to a string with a given separator.
A tail recursive version of string-merge.