(scm_oneplus, scm_oneminus): New functions, converted from
authorKevin Ryde <user42@zip.com.au>
Thu, 14 Apr 2005 00:35:50 +0000 (00:35 +0000)
committerKevin Ryde <user42@zip.com.au>
Thu, 14 Apr 2005 00:35:50 +0000 (00:35 +0000)
scheme code in boot-9.scm.

libguile/numbers.c
libguile/numbers.h

index 769cb7a..08483d8 100644 (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."
index 746dd00..4b5140a 100644 (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);