utils.scrbl: Remove Composing typed functions.
I exported everything to typed-compose now.
This commit is contained in:
parent
e73cdc2366
commit
0f971f5258
1 changed files with 0 additions and 44 deletions
|
@ -116,50 +116,6 @@ passed in the first argument.
|
|||
|
||||
}
|
||||
|
||||
@section{Composing typed functions}
|
||||
|
||||
Typed Racket's @racket[compose] only takes two arguments, because in general it
|
||||
is difficult to specify that the return types and the argument types should be
|
||||
the same for two successive functions in the argument list. This section
|
||||
defines some further utilities which make using @racket[compose]
|
||||
more comfortable.
|
||||
|
||||
@defproc[(compose-n [proc (-> a a)] ...) (-> a a)]{
|
||||
|
||||
Compose an arbitrary number of functions of type @racket[(-> a a)].
|
||||
|
||||
@examples[#:eval utils-evaluator
|
||||
((compose-n add1 add1 add1) 3)
|
||||
]}
|
||||
|
||||
@defproc*[([(compose-3 [proc1 (-> c d)] [proc2 (-> b c)] [proc3 (-> a b)]) (-> a d)]
|
||||
[(compose-4 [proc1 (-> d e)] [proc2 (-> c d)] [proc3 (-> b c)] [proc4 (-> a b)]) (-> a e)])]{
|
||||
|
||||
@racket[compose-i] composes @racket[i] functions. The rightmost function is
|
||||
applied first.
|
||||
|
||||
@examples[#:eval utils-evaluator
|
||||
(define (s->n [x : String]) (cast (string->number x) Number))
|
||||
(define fancy-add1 (compose-3 print add1 s->n))
|
||||
fancy-add1
|
||||
(fancy-add1 "1")
|
||||
]}
|
||||
|
||||
@defform[(multi-compose func ...)
|
||||
#:contracts ([func expression])]{
|
||||
|
||||
Expands to a code applying @racket[compose] in a pairwise manner to the given
|
||||
expressions. For example, @racket[(multi-compose f1 f2 f3 f4)] expands to
|
||||
@racket[(compose f1 (compose f2 (compose f3 f4)))].
|
||||
|
||||
@examples[#:eval utils-evaluator
|
||||
((multi-compose add1
|
||||
(λ ([x : Number]) (* x 3))
|
||||
add1
|
||||
(λ ([x : Number]) (+ x 2)))
|
||||
3)
|
||||
]}
|
||||
|
||||
@section{Org-mode interoperability}
|
||||
|
||||
Org-mode supports laying out the output of code blocks as tables, which is very
|
||||
|
|
Loading…
Reference in a new issue