mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 20:00:19 +02:00
+ is not an asubr
* libguile/numbers.h: * libguile/numbers.c (scm_i_sum): Rework so that scm_sum is just a normal function. Its generic is actually provided by scm_i_sum, a gsubr with rest args. In that way, + is no longer an asubr.
This commit is contained in:
parent
b04ab0c624
commit
8ccd24f7bb
2 changed files with 19 additions and 4 deletions
|
@ -3991,10 +3991,24 @@ scm_min (SCM x, SCM y)
|
|||
}
|
||||
|
||||
|
||||
SCM_GPROC1 (s_sum, "+", scm_tc7_asubr, scm_sum, g_sum);
|
||||
/* "Return the sum of all parameter values. Return 0 if called without\n"
|
||||
* "any parameters."
|
||||
*/
|
||||
SCM_PRIMITIVE_GENERIC (scm_i_sum, "+", 0, 2, 1,
|
||||
(SCM x, SCM y, SCM rest),
|
||||
"Return the sum of all parameter values. Return 0 if called without\n"
|
||||
"any parameters." )
|
||||
#define FUNC_NAME s_scm_i_sum
|
||||
{
|
||||
while (!scm_is_null (rest))
|
||||
{ x = scm_sum (x, y);
|
||||
y = scm_car (rest);
|
||||
rest = scm_cdr (rest);
|
||||
}
|
||||
return scm_sum (x, y);
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
#define s_sum s_scm_i_sum
|
||||
#define g_sum g_scm_i_sum
|
||||
|
||||
SCM
|
||||
scm_sum (SCM x, SCM y)
|
||||
{
|
||||
|
|
|
@ -238,6 +238,7 @@ SCM_API SCM scm_negative_p (SCM x);
|
|||
SCM_API SCM scm_max (SCM x, SCM y);
|
||||
SCM_API SCM scm_min (SCM x, SCM y);
|
||||
SCM_API SCM scm_sum (SCM x, SCM y);
|
||||
SCM_INTERNAL SCM scm_i_sum (SCM x, SCM y, SCM rest);
|
||||
SCM_API SCM scm_oneplus (SCM x);
|
||||
SCM_API SCM scm_difference (SCM x, SCM y);
|
||||
SCM_API SCM scm_oneminus (SCM x);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue