(index ("timeout-condition?" 0) ("eager" 131) ("lazy" 284) ("delay" 397) ("delay/timeout" 533) ("future" 763) ("&begin" 763) ("future/timeout" 1208) ("&begin/timeout" 1208) ("order" 1670) ("order/timeout" 1960) ("lazy-future" 2221) ("demand" 2505) ("force" 2778) ("expectable" 3277) ("fulfil!" 3969))
(def (sig (procedure "(timeout-condition? x) -> boolean" (id timeout-condition?))) (p "Test x to be a timeout condition object."))
(def (sig (procedure "(eager . vals) -> PROMISE" (id eager))) (p "Returns a promise which, when " (tt "force") "d returns the values " (tt "vals") "."))
(def (sig (syntax "(lazy EXPRESSION) -> PROMISE" (id lazy))) (p "Returns a promise for " (tt "EXPRESSION") "."))
(def (sig (syntax "(delay EXPRESSION) -> PROMISE" (id delay))) (p "Returns a promise, a delayed evaluation of " (tt "EXPRESSION") "."))
(def (sig (syntax "(delay/timeout TIMEOUT EXPRESSION) -> PROMISE" (id delay/timeout))) (p "Same as " (tt "delay EXPRESSION") ".  Promise may fail raising an object for which " (tt "timeout-condition?") " returns " (tt "#t") "."))
(def (sig (syntax "(future EXPRESSION) -> PROMISE" (id future)) (syntax "(&begin BODY ...) -> PROMISE" (id &begin))) (p "Returns a promise, a delayed evaluation of " (tt "EXPRESSION") ".  The evaluation of expression is started immediately in another thread. " (tt "PROMISE") " will cache exceptions returned by " (tt "EXPRSSION") ".") (p (tt "&begin") " is analogous to " (tt "future") " with " (tt "BODY ...") " wraped in " (tt "begin") "."))
(def (sig (syntax "(future/timeout TIMEOUT EXPRESSION) -> PROMISE" (id future/timeout)) (syntax "(&begin/timeout TIMEOUT BODY ...) -> PROMISE" (id &begin/timeout))) (p "Variation of " (tt "future") ".  The evaluation of " (tt "EXPRESSION") " receives an exceptions for which " (tt "timeout-condition?") " holds after " (tt "TIMEOUT") ".") (p (tt "&begin/timeout") " is the same as " (tt "future/timeout") " with " (tt "BODY ...") " waped in " (tt "begin") "."))
(def (sig (syntax "(order EXPRESSION) -> PROMISE" (id order))) (p "Returns a promise, a delayed evaluation of " (tt "EXPRESSION") ".  The evaluation of expression is ordered from another thread in a threadpool.  " (tt "PROMISE") " will cache exceptions returned by " (tt "EXPRSSION") "."))
(def (sig (syntax "(order/timeout TIMEOUT EXPRESSION) -> PROMISE" (id order/timeout))) (p "Variation of " (tt "order") ".  The evaluation of " (tt "EXPRESSION") " receives an exceptions for which " (tt "timeout-condition?") " holds after " (tt "TIMEOUT") "."))
(def (sig (syntax "(lazy-future EXPRESSION) -> PROMISE" (id lazy-future))) (p "Same as " (tt "future") " however the thread is NOT started.  Use " (tt "demand") " to start it prior to " (tt "force") ".  Use of " (tt "force") " will also start it if not " (tt "demand") "ed before."))
(def (sig (procedure "(demand PROMISE) -> boolean" (id demand))) (p "If the " (tt "PROMISE") " was created by " (tt "lazy-future") " and the thread is not yet started, start it.  Returns " (tt "#t") " if the thread was started only now, otherwise returns " (tt "#f") "."))
(def (sig (procedure "(force OBJECT [FAIL]) -> . *" (id force))) (p "Force " (tt "OBJECT") ".  Returns " (tt "OBJECT") " if it is NOT a promise. Otherwise returns the values the suspended " (tt "EXPRESSION") " returned.") (p "If " (tt "FAIL") " is provided it must be a procedure of one argument. Exceptions raised from the " (tt "EXPRESSION") " are passed to " (tt "FAIL") ".") (p "This is equivalent to (but more efficiently implemented)") (pre "(handle-exceptions ex (FAIL ex) (force OBJECT))"))
(def (sig (procedure "(expectable [NAME] [THUNK]) -> PROCEDURE PROMISE" (id expectable))) (p (tt "NAME") " is any object and used for debug purposes only (currently passed as name of an internal mutex).  Returns two values. " (tt "PROCEDURE") " takes a flag indicating whether the " (tt "PROMISE") " shall return successful (if " (tt "#t") ") or fail and values to return from " (tt "force") "ing the " (tt "PROMISE") ".  If the flag is " (tt "#f") " only the first of those values is used and passed to the exception handler as the exception raised from the " (tt "PROMISE") ".") (p "When " (tt "THUNK") " is given the resulting promise behaves like a promise created by " (tt "lazy") "."))
(def (sig (procedure "(fulfil! PROMISE TYPE . ARGS) -> boolean" (id fulfil!))) (p "Mutate " (tt "PROMISE") " to be fulfilled.  " (tt "TYPE") " must be a boolean.  If " (tt "#t") " the " (tt "PROMISE") " is set to return successfully the values " (tt "ARGS") ".  If " (tt "TYPE") " is " (tt "#f") " the " (tt "PROMISE") " will raise the first value of " (tt "ARGS") " as exception.") (p "Note: This procedure MAY be removed in future versions (if it proves to be questionable)."))
