remove cruft
This commit is contained in:
parent
f69f6e412e
commit
bacdf3bf70
182
src/math.c
182
src/math.c
|
@ -43,28 +43,6 @@ assert_number (char const *name, struct scm *x)
|
||||||
#define TYPE(x) x->type
|
#define TYPE(x) x->type
|
||||||
#define MAKE_NUMBER(x) make_number (x)
|
#define MAKE_NUMBER(x) make_number (x)
|
||||||
|
|
||||||
#if 0
|
|
||||||
struct scm *
|
|
||||||
greater_p (struct scm *x) /*:((name . ">") (arity . n)) */
|
|
||||||
{
|
|
||||||
if (x == cell_nil)
|
|
||||||
return cell_t;
|
|
||||||
assert_number ("greater_p", CAR (x));
|
|
||||||
long n = VALUE (CAR (x));
|
|
||||||
x = CDR (x);
|
|
||||||
while (x != cell_nil)
|
|
||||||
{
|
|
||||||
assert_number ("greater_p", CAR (x));
|
|
||||||
if (VALUE (car (x)) >= n)
|
|
||||||
return cell_f;
|
|
||||||
n = VALUE (car (x));
|
|
||||||
x = cdr (x);
|
|
||||||
}
|
|
||||||
return cell_t;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
struct scm *
|
struct scm *
|
||||||
greater_p (struct scm *x) /*:((name . ">") (arity . n)) */
|
greater_p (struct scm *x) /*:((name . ">") (arity . n)) */
|
||||||
{
|
{
|
||||||
|
@ -88,30 +66,6 @@ greater_p (struct scm *x) /*:((name . ">") (arity . n)) */
|
||||||
return cell_t;
|
return cell_t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
struct scm *
|
|
||||||
less_p (struct scm *x) /*:((name . "<") (arity . n)) */
|
|
||||||
{
|
|
||||||
if (x == cell_nil)
|
|
||||||
return cell_t;
|
|
||||||
assert_number ("less_p", CAR (x));
|
|
||||||
long n = VALUE (CAR (x));
|
|
||||||
x = CDR (x);
|
|
||||||
while (x != cell_nil)
|
|
||||||
{
|
|
||||||
assert_number ("less_p", CAR (x));
|
|
||||||
if (VALUE (car (x)) <= n)
|
|
||||||
return cell_f;
|
|
||||||
n = VALUE (car (x));
|
|
||||||
x = cdr (x);
|
|
||||||
}
|
|
||||||
return cell_t;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
struct scm *
|
struct scm *
|
||||||
less_p (struct scm *x) /*:((name . "<") (arity . n)) */
|
less_p (struct scm *x) /*:((name . "<") (arity . n)) */
|
||||||
{
|
{
|
||||||
|
@ -134,26 +88,7 @@ less_p (struct scm *x) /*:((name . "<") (arity . n)) */
|
||||||
}
|
}
|
||||||
return cell_t;
|
return cell_t;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
struct scm *
|
|
||||||
is_p (struct scm *x) /*:((name . "=") (arity . n)) */
|
|
||||||
{
|
|
||||||
if (x == cell_nil)
|
|
||||||
return cell_t;
|
|
||||||
assert_number ("is_p", CAR (x));
|
|
||||||
long n = VALUE (CAR (x));
|
|
||||||
x = cdr (x);
|
|
||||||
while (x != cell_nil)
|
|
||||||
{
|
|
||||||
if (VALUE (car (x)) != n)
|
|
||||||
return cell_f;
|
|
||||||
x = cdr (x);
|
|
||||||
}
|
|
||||||
return cell_t;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
struct scm *
|
struct scm *
|
||||||
is_p (struct scm *x) /*:((name . "=") (arity . n)) */
|
is_p (struct scm *x) /*:((name . "=") (arity . n)) */
|
||||||
{
|
{
|
||||||
|
@ -174,26 +109,7 @@ is_p (struct scm *x) /*:((name . "=") (arity . n)) */
|
||||||
}
|
}
|
||||||
return cell_t;
|
return cell_t;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
struct scm *
|
|
||||||
minus (struct scm *x) /*:((name . "-") (arity . n)) */
|
|
||||||
{
|
|
||||||
assert_number ("minus", CAR (x));
|
|
||||||
long n = VALUE (CAR (x));
|
|
||||||
x = cdr (x);
|
|
||||||
if (x == cell_nil)
|
|
||||||
n = -n;
|
|
||||||
while (x != cell_nil)
|
|
||||||
{
|
|
||||||
assert_number ("minus", CAR (x));
|
|
||||||
n -= VALUE (car (x));
|
|
||||||
x = cdr (x);
|
|
||||||
}
|
|
||||||
return MAKE_NUMBER (n);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
struct scm *
|
struct scm *
|
||||||
minus (struct scm *x) /*:((name . "-") (arity . n)) */
|
minus (struct scm *x) /*:((name . "-") (arity . n)) */
|
||||||
{
|
{
|
||||||
|
@ -214,22 +130,7 @@ minus (struct scm *x) /*:((name . "-") (arity . n)) */
|
||||||
}
|
}
|
||||||
return make_number (n);
|
return make_number (n);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
struct scm *
|
|
||||||
plus (struct scm *x) /*:((name . "+") (arity . n)) */
|
|
||||||
{
|
|
||||||
long n = 0;
|
|
||||||
while (x != cell_nil)
|
|
||||||
{
|
|
||||||
assert_number ("plus", CAR (x));
|
|
||||||
n += VALUE (car (x));
|
|
||||||
x = cdr (x);
|
|
||||||
}
|
|
||||||
return MAKE_NUMBER (n);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
struct scm *
|
struct scm *
|
||||||
plus (struct scm *x) /*:((name . "+") (arity . n)) */
|
plus (struct scm *x) /*:((name . "+") (arity . n)) */
|
||||||
{
|
{
|
||||||
|
@ -246,7 +147,6 @@ plus (struct scm *x) /*:((name . "+") (arity . n)) */
|
||||||
}
|
}
|
||||||
return make_number (n);
|
return make_number (n);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
struct scm *
|
struct scm *
|
||||||
|
@ -361,20 +261,6 @@ modulo (struct scm *a, struct scm *b)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
|
||||||
struct scm *
|
|
||||||
multiply (struct scm *x) /*:((name . "*") (arity . n)) */
|
|
||||||
{
|
|
||||||
long n = 1;
|
|
||||||
while (x != cell_nil)
|
|
||||||
{
|
|
||||||
assert_number ("multiply", CAR (x));
|
|
||||||
n *= VALUE (car (x));
|
|
||||||
x = cdr (x);
|
|
||||||
}
|
|
||||||
return MAKE_NUMBER (n);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
struct scm *
|
struct scm *
|
||||||
multiply (struct scm *x) /*:((name . "*") (arity . n)) */
|
multiply (struct scm *x) /*:((name . "*") (arity . n)) */
|
||||||
{
|
{
|
||||||
|
@ -391,22 +277,7 @@ multiply (struct scm *x) /*:((name . "*") (arity . n)) */
|
||||||
}
|
}
|
||||||
return make_number (n);
|
return make_number (n);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
SCM
|
|
||||||
logand (SCM x) ///((arity . n))
|
|
||||||
{
|
|
||||||
long n = 0;
|
|
||||||
while (x != cell_nil)
|
|
||||||
{
|
|
||||||
assert_number ("multiply", CAR (x));
|
|
||||||
n &= VALUE (car (x));
|
|
||||||
x = cdr (x);
|
|
||||||
}
|
|
||||||
return MAKE_NUMBER (n);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
struct scm *
|
struct scm *
|
||||||
logand (struct scm *x) /*:((arity . n)) */
|
logand (struct scm *x) /*:((arity . n)) */
|
||||||
{
|
{
|
||||||
|
@ -423,22 +294,7 @@ logand (struct scm *x) /*:((arity . n)) */
|
||||||
}
|
}
|
||||||
return make_number (n);
|
return make_number (n);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
struct scm *
|
|
||||||
logior (struct scm *x) /*:((arity . n)) */
|
|
||||||
{
|
|
||||||
long n = 0;
|
|
||||||
while (x != cell_nil)
|
|
||||||
{
|
|
||||||
assert_number ("logior", CAR (x));
|
|
||||||
n |= VALUE (car (x));
|
|
||||||
x = cdr (x);
|
|
||||||
}
|
|
||||||
return MAKE_NUMBER (n);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
struct scm *
|
struct scm *
|
||||||
logior (struct scm *x) /*:((arity . n)) */
|
logior (struct scm *x) /*:((arity . n)) */
|
||||||
{
|
{
|
||||||
|
@ -455,17 +311,7 @@ logior (struct scm *x) /*:((arity . n)) */
|
||||||
}
|
}
|
||||||
return make_number (n);
|
return make_number (n);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
struct scm *
|
|
||||||
lognot (struct scm *x)
|
|
||||||
{
|
|
||||||
assert_number ("lognot", x);
|
|
||||||
long n = ~VALUE (x);
|
|
||||||
return MAKE_NUMBER (n);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
struct scm *
|
struct scm *
|
||||||
lognot (struct scm *x)
|
lognot (struct scm *x)
|
||||||
{
|
{
|
||||||
|
@ -473,22 +319,7 @@ lognot (struct scm *x)
|
||||||
long n = ~x->value;
|
long n = ~x->value;
|
||||||
return make_number (n);
|
return make_number (n);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
struct scm *
|
|
||||||
logxor (struct scm *x) /*:((arity . n)) */
|
|
||||||
{
|
|
||||||
long n = 0;
|
|
||||||
while (x != cell_nil)
|
|
||||||
{
|
|
||||||
assert_number ("logxor", CAR (x));
|
|
||||||
n ^= VALUE (car (x));
|
|
||||||
x = cdr (x);
|
|
||||||
}
|
|
||||||
return MAKE_NUMBER (n);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
struct scm *
|
struct scm *
|
||||||
logxor (struct scm *x) /*:((arity . n)) */
|
logxor (struct scm *x) /*:((arity . n)) */
|
||||||
{
|
{
|
||||||
|
@ -505,19 +336,7 @@ logxor (struct scm *x) /*:((arity . n)) */
|
||||||
}
|
}
|
||||||
return make_number (n);
|
return make_number (n);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
struct scm *
|
|
||||||
ash (struct scm *n, struct scm *count)
|
|
||||||
{
|
|
||||||
assert_number ("ash", n);
|
|
||||||
assert_number ("ash", count);
|
|
||||||
long cn = VALUE (n);
|
|
||||||
long ccount = VALUE (count);
|
|
||||||
return MAKE_NUMBER ((ccount < 0) ? cn >> -ccount : cn << ccount);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
struct scm *
|
struct scm *
|
||||||
ash (struct scm *n, struct scm *count)
|
ash (struct scm *n, struct scm *count)
|
||||||
{
|
{
|
||||||
|
@ -532,4 +351,3 @@ ash (struct scm *n, struct scm *count)
|
||||||
result = cn << ccount;
|
result = cn << ccount;
|
||||||
return make_number (result);
|
return make_number (result);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in New Issue