Lecture overview -- Keyboard shortcut: 'u'  Previous page: Zipping -- Keyboard shortcut: 'p'  Next page: Currying [Section] -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home    Lecture 4 - Page 19 : 34
Functional Programming in Scheme
Higher-order Functions
The zipping function

y:/Kurt/Files/courses/prog3/prog3-03/sources/notes/includes/zipping.scmThe function zip.


Expression

Value

(zip cons '(1 2 3) '(a b c))
((1 . a) (2 . b) (3 . c))
(apply string-append
 (zip 
  string-append
  '("Rip" "Rap" "Rup")
  '(", " ", and " "")))
"Rip, Rap, and Rup"
(string-merge 
  '("Rip" "Rap" "Rup") '(", " ", and "))
"Rip, Rap, and Rup"

Examples of zipping.

Zip is similar to the function string-merge from the LAML general library

However, string-merge handles lists of strings non-equal lengths, and it concatenates the zipped results