mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-29 00:10:21 +02:00
export `make-promise' to scheme
* libguile/eval.h: * libguile/eval.c (scm_make_promise): Rename from `scm_makprom', and export as the scheme procedure, `make-promise'. * libguile/eval.i.c (CEVAL): s/makprom/make_promise/.
This commit is contained in:
parent
8ab3c80f8b
commit
7c455996e8
3 changed files with 15 additions and 5 deletions
|
@ -3662,13 +3662,23 @@ scm_closure (SCM code, SCM env)
|
||||||
|
|
||||||
scm_t_bits scm_tc16_promise;
|
scm_t_bits scm_tc16_promise;
|
||||||
|
|
||||||
SCM
|
SCM_DEFINE (scm_make_promise, "make-promise", 1, 0, 0,
|
||||||
scm_makprom (SCM code)
|
(SCM thunk),
|
||||||
|
"Create a new promise object.\n\n"
|
||||||
|
"@code{make-promise} is a procedural form of @code{delay}.\n"
|
||||||
|
"These two expressions are equivalent:\n"
|
||||||
|
"@lisp\n"
|
||||||
|
"(delay @var{exp})\n"
|
||||||
|
"(make-promise (lambda () @var{exp}))\n"
|
||||||
|
"@end lisp\n")
|
||||||
|
#define FUNC_NAME s_scm_make_promise
|
||||||
{
|
{
|
||||||
|
SCM_VALIDATE_THUNK (1, thunk);
|
||||||
SCM_RETURN_NEWSMOB2 (scm_tc16_promise,
|
SCM_RETURN_NEWSMOB2 (scm_tc16_promise,
|
||||||
SCM_UNPACK (code),
|
SCM_UNPACK (thunk),
|
||||||
scm_make_recursive_mutex ());
|
scm_make_recursive_mutex ());
|
||||||
}
|
}
|
||||||
|
#undef FUNC_NAME
|
||||||
|
|
||||||
static SCM
|
static SCM
|
||||||
promise_mark (SCM promise)
|
promise_mark (SCM promise)
|
||||||
|
|
|
@ -162,7 +162,7 @@ SCM_API SCM scm_dapply (SCM proc, SCM arg1, SCM args);
|
||||||
SCM_API SCM scm_map (SCM proc, SCM arg1, SCM args);
|
SCM_API SCM scm_map (SCM proc, SCM arg1, SCM args);
|
||||||
SCM_API SCM scm_for_each (SCM proc, SCM arg1, SCM args);
|
SCM_API SCM scm_for_each (SCM proc, SCM arg1, SCM args);
|
||||||
SCM_API SCM scm_closure (SCM code, SCM env);
|
SCM_API SCM scm_closure (SCM code, SCM env);
|
||||||
SCM_API SCM scm_makprom (SCM code);
|
SCM_API SCM scm_make_promise (SCM thunk);
|
||||||
SCM_API SCM scm_force (SCM x);
|
SCM_API SCM scm_force (SCM x);
|
||||||
SCM_API SCM scm_promise_p (SCM x);
|
SCM_API SCM scm_promise_p (SCM x);
|
||||||
SCM_API SCM scm_cons_source (SCM xorig, SCM x, SCM y);
|
SCM_API SCM scm_cons_source (SCM xorig, SCM x, SCM y);
|
||||||
|
|
|
@ -732,7 +732,7 @@ dispatch:
|
||||||
|
|
||||||
|
|
||||||
case (ISYMNUM (SCM_IM_DELAY)):
|
case (ISYMNUM (SCM_IM_DELAY)):
|
||||||
RETURN (scm_makprom (scm_closure (SCM_CDR (x), env)));
|
RETURN (scm_make_promise (scm_closure (SCM_CDR (x), env)));
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* See futures.h for a comment why futures are not enabled.
|
/* See futures.h for a comment why futures are not enabled.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue