previous up next     contents index
Next: Macros Up: Libraries Previous: Files

Utilities

  Files: ``functio.ss'', ``functiou.ss'', ``functios.ss'', ``functioc.ss''
Signature: mzlib:function tex2html_wrap_inline2054
Unit:  mzlib:function@

The procedures  first,  second,  third,  fourth,  fifth,  sixth,  seventh, and  eighth access the corresponding element from a list.

 

(compose f g) (procedure)

Returns a procedure that takes x and returns (call-with-values (lambda () (g x)) f).

 

(dynamic-disable-break thunk) (procedure)

Invokes thunk and returns the result. During the application of thunk, user breaks are disabled.

 

(dynamic-wind/protect-break pre-thunk value-thunk post-thunk) (procedure)

Like dynamic-wind, except that the pre-thunk and post-thunk procedures are protected from a user-break. (Users breaks are allowed in value-thunk only if breaking is otherwise allowed.)

 

(foldl f init l ...) (procedure)

Like map, foldl applies a procedure f to the elements of one or more lists. While map combines the return values into a list, foldl combines the return values in an abitrary way that is determined by f.

If foldl is called with n lists, the f procedure takes n+1 arguments. The extra value is the combined return values so far. The f procedure is initially invoked with the first item of each list; the final argument is init. In subsequent invocations of f, the last argument is the return value from the previous invocation of f. The input lists are traversed from left to right, and the result of the whole foldl application is the result of the last application of f. (If the lists are empty, the result is init.)

For example, reverse can be defined in terms of foldl:

 
   (define reverse
     (lambda (l)
       (foldl cons '() l))) 

 

(foldr f init l ...) (procedure)

Like foldl, but the lists are traversed from right to left.

For example, map can be defined in terms of foldr:

 
   (define map
     (lambda (f . lists)
       (apply foldr (lambda (v l) (cons (f v) l)) '() lists))) 

 

(identity x) (procedure)

Returns x.

 

(ignore-errors thunk) (procedure)

Invokes thunk and returns the result. If an error occurs during the application of thunk, no error is reported and #<void> is returned.

 

(make-single-threader) (procedure)

Returns a new procedure that takes any thunk and applies it. When this procedure is applied to any collection of thunks by any collection of threads, the thunks are applied sequentially across all threads.

 

(quicksort list less-than?) (procedure)

Sorts list using the comparison procedure less-than?.

 

(remove item list equal?) (procedure)

Returns list without item. The equal? argument is optional; it defaults to equal?. When equal? is invoked, item is the first argument.

 

(remq item list) (procedure)

Calls remove with eq? as the comparison procedure.

 

(remv item list) (procedure)

Calls remove with eqv? as the comparison procedure.


previous up next     contents index
Next: Macros Up: Libraries Previous: Files

PLT