1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

(scm_oneplus, scm_oneminus): New functions, converted from

scheme code in boot-9.scm.
This commit is contained in:
Kevin Ryde 2005-04-14 00:35:50 +00:00
parent 78fae16113
commit 40882e3d0b
2 changed files with 22 additions and 0 deletions

View file

@ -4107,6 +4107,16 @@ scm_sum (SCM x, SCM y)
}
SCM_DEFINE (scm_oneplus, "1+", 1, 0, 0,
(SCM x),
"Return @math{@var{x}+1}.")
#define FUNC_NAME s_scm_oneplus
{
return scm_sum (x, SCM_I_MAKINUM (1));
}
#undef FUNC_NAME
SCM_GPROC1 (s_difference, "-", scm_tc7_asubr, scm_difference, g_difference);
/* If called with one argument @var{z1}, -@var{z1} returned. Otherwise
* the sum of all but the first argument are subtracted from the first
@ -4342,6 +4352,16 @@ scm_difference (SCM x, SCM y)
#undef FUNC_NAME
SCM_DEFINE (scm_oneminus, "1-", 1, 0, 0,
(SCM x),
"Return @math{@var{x}-1}.")
#define FUNC_NAME s_scm_oneminus
{
return scm_difference (x, SCM_I_MAKINUM (1));
}
#undef FUNC_NAME
SCM_GPROC1 (s_product, "*", scm_tc7_asubr, scm_product, g_product);
/* "Return the product of all arguments. If called without arguments,\n"
* "1 is returned."

View file

@ -238,7 +238,9 @@ 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_API SCM scm_oneplus (SCM x);
SCM_API SCM scm_difference (SCM x, SCM y);
SCM_API SCM scm_oneminus (SCM x);
SCM_API SCM scm_product (SCM x, SCM y);
SCM_API SCM scm_divide (SCM x, SCM y);
SCM_API SCM scm_floor (SCM x);