This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home.

Source for wiki ConditionalProceduresSamizdat version 3

author

cowan

comment


    

ipnr

127.11.51.1

name

ConditionalProceduresSamizdat

readonly

0

text

These are Scheme procedures that correspond to basic syntax.  They are derived from [https://github.com/danfuzz/samizdat/blob/master/doc/library-guide/If.md the If class of Samizdat].

`(begin-procedure `''thunk'' ...`)`

Invokes ''thunks'' in order, and returns what the last thunk returns, or an unspecified value if there are no thunks.

`(if-procedure `''value then-thunk'' [ ''else-thunk'' ]`)`

If ''value'' is true, invokes ''then-thunk'' and returns what it returns.  Otherwise, invokes ''else-thunk'' and returns what it returns, or if ''else-thunk'' is not specified, returns an unspecified value.

`(if-not-procedure `''value else-thunk''`)`

If ''value'' is true, returns an unspecified value.  Otherwise, invokes ''else-thunk'' and returns what it returns.

`(value-procedure `''value then-proc else-thunk''`)`

If ''value'' is true, invokes ''then-proc'' on it and returns what ''then-proc'' returns.  Otherwise, invokes ''else-thunk'' and returns what it returns.

`(case-procedure `''value thunk-alist'' [ ''else-thunk'' ]`)`

Searches ''thunk-alist'' for ''value'' (as if by `assv`).  If there is no such entry in ''thunk-alist'', invokes ''else-thunk'' and returns what it returns, or returns an unspecified value if ''else-thunk'' is not provided.  If there is a matching entry in ''thunk-alist'', its cdr is invoked as a thunk, and `case-procedure` returns what the thunk returns.

`(and-procedure `''thunk'' ...`)`

Invokes each ''thunk'' in the order given, and returns `#f` immediately if any of them return `#f`.  Otherwise returns the value of the last thunk, or `#t` if there are none.

`(or-procedure `''thunk'' ...`)`

Invokes each ''thunk'' in the order given, and if any of them returns true, `or-procedure` returns that value immediately.  Otherwise returns `#f`.

`(loop-procedure `''thunk''`)`

Invokes ''thunk'' repeatedly.  Does not return.

`(while-procedure `''thunk''`)`

Invokes ''thunk'' repeatedly until it returns `#f`.  Returns an unspecified value.


time

2014-12-23 03:34:59

version

3