mapper.scrbl (932B)
1 #lang scribble/manual 2 3 @(require scribble/eval 4 (for-label kw-utils/mapper 5 kw-utils/partial 6 kw-utils/kw-map 7 (except-in racket/base map) 8 racket/contract/base 9 racket/function 10 )) 11 12 @title{Creating functions that map over lists} 13 14 @defmodule[kw-utils/mapper] 15 16 @defproc*[([(mapper [f procedure?] [arg any/c] ... [#:<kw> kw-arg any/c] ...) procedure?] 17 [(mapper [#:<kw> kw-arg any/c] ...) procedure?])]{ 18 The one-argument case is equivalent to a curried version of @racket[map]. 19 20 @racket[(mapper f)] is equivalent to @racket[(partial map f)], and 21 @racket[(mapper arg ...)] is equivalent to 22 @racket[(partial map (partial arg ...))]. 23 @examples[ 24 (require kw-utils/mapper) 25 ((mapper add1) '(1 2 3)) 26 ((mapper +) '(1 2 3) '(4 5 6)) 27 ((mapper + 3) '(1 2 3)) 28 ((mapper + 3) '(1 2 3) '(4 5 6)) 29 ]} 30