Beispiel #1
0
 public int lisphashCode(int n) {
   int r = 19937;
   for (int i = 0; i < vec.length; i++) {
     LispObject b = vec[i];
     if (b == null) r = 54321 * r;
     else if (!b.atom) r = 169 * r + ((Cons) b).lisphashCode(b, n - 10);
     else r = 0x8040201 * r + b.lisphashCode();
   }
   return r;
 }
Beispiel #2
0
 public boolean leq(LispObject a) throws Exception {
   return (value <= a.doubleValue());
 }
Beispiel #3
0
 public boolean ge(LispObject a) throws Exception {
   return (value > a.doubleValue());
 }
Beispiel #4
0
 public boolean neqn(LispObject a) throws Exception {
   return (value != a.doubleValue());
 }
Beispiel #5
0
 public LispObject min(LispObject a) throws Exception {
   return (value <= a.doubleValue() ? this : a);
 }
Beispiel #6
0
 public LispObject expt(LispObject a) throws Exception {
   // it is possible that I should delect cases where a is an integer
   // and raise to a power using some alternative scheme, like repeated
   // multiplication.
   return new LispFloat(Math.pow(value, a.doubleValue()));
 }
Beispiel #7
0
 public LispObject remainder(LispObject a) throws Exception {
   return new LispFloat(value % a.doubleValue());
 }
Beispiel #8
0
 public LispObject divide(LispObject a) throws Exception {
   return new LispFloat(value / a.doubleValue());
 }
Beispiel #9
0
 public LispObject multiply(LispObject a) throws Exception {
   return new LispFloat(value * a.doubleValue());
 }
Beispiel #10
0
 public LispObject subtract(LispObject a) throws Exception {
   return new LispFloat(value - a.doubleValue());
 }
Beispiel #11
0
 public LispObject add(LispObject a) throws Exception {
   return new LispFloat(value + a.doubleValue());
 }
Beispiel #12
0
 public void print(int fg) throws ResourceException {
   Jlisp.print("#CALL" + (nargs & 0xf) + "as" + ((nargs >> 4) & 0xf) + "<");
   body.print(fg);
   Jlisp.print(">");
 }