Lecture overview -- Keyboard shortcut: 'u'  Previous page: Examples of currying -- Keyboard shortcut: 'p'  Next page: Ad hoc currying in Scheme (2) -- 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 24 : 34
Functional Programming in Scheme
Higher-order Functions
Ad hoc currying in Scheme (1)

It is possible to achieve 'the currying effect' by generalizing functions, which requires two or more parameters, to only require a single parameter




(map li (list "one" "two" "three"))
(define li-mapper (map li))
map: expects at least 2 arguments, given 1
(define li-mapper ((curry2 map) li))
(li-mapper (list "one" "two" "three"))

A legal mapping and an impossible attempt to curry the mapping function. The last example shows an application of curry2 to achieve the wanted effect, but as it appears, the solution is not very elegant.

y:/Kurt/Files/courses/prog3/prog3-03/sources/notes/includes/interesting-stuff.scmThe function curry-generalized.

This is a higher-order function which generalizes the function passed as parameter to curry-generalized. The generalization provides for just passing a single parameter to f, in the vein of currying.