package globals;

import util.KawaWrap;

public class WMath extends Globals {
	/**
	 * Add methods related to (random n)
	 * 
	 * @param kawa The interpreter to add them to.
	 * @throws Throwable If anything breaks while adding them.
	 */
	@Override
	public void addMethods(KawaWrap kawa) throws Throwable {
    	kawa.eval("(define (sub1 n) (- n 1))");
    	kawa.eval("(define (add1 n) (+ n 1))");
	}
}

@@ -13,16 +13,73 @@
 als;%0D%0A%0D%0A
+import gnu.mapping.Procedure1;%0D%0Aimport gnu.math.IntNum;%0D%0A
 import u
@@ -463,15 +463,724 @@
 1))%22);%0D%0A
+    %09%0D%0A    %09kawa.bind(new Procedure1(%22even?%22) %7B%0D%0A%09%09%09@Override%0D%0A%09%09%09public Object apply1(Object arg1) throws Throwable %7B%0D%0A%09%09%09%09if (!(arg1 instanceof IntNum))%0D%0A%09%09%09%09%09throw new IllegalArgumentException(%22Error in even?, expected integer as first argument, got '%22 + KawaWrap.formatObject(arg1) + %22'.%22);%0D%0A%09%09%09%09%0D%0A%09%09%09%09return !((IntNum) arg1).isOdd();%0D%0A%09%09%09%7D%0D%0A    %09%7D);%0D%0A    %09%0D%0A    %09kawa.bind(new Procedure1(%22odd?%22) %7B%0D%0A%09%09%09@Override%0D%0A%09%09%09public Object apply1(Object arg1) throws Throwable %7B%0D%0A%09%09%09%09if (!(arg1 instanceof IntNum))%0D%0A%09%09%09%09%09throw new IllegalArgumentException(%22Error in odd?, expected integer as first argument, got '%22 + KawaWrap.formatObject(arg1) + %22'.%22);%0D%0A%09%09%09%09%0D%0A%09%09%09%09return ((IntNum) arg1).isOdd();%0D%0A%09%09%09%7D%0D%0A    %09%7D);%0D%0A
 %09%7D%0D%0A%7D%0D%0A

Fix for even? and odd?