public static Environment installPrimitives(Environment env)
{
int n = Int32.MaxValue;
env
.defPrim("*", TIMES, 0, n)
.defPrim("*", TIMES, 0, n)
.defPrim("+", PLUS, 0, n)
.defPrim("-", MINUS, 1, n)
.defPrim("/", DIVIDE, 1, n)
.defPrim("<", LT, 2, n)
.defPrim("<=", LE, 2, n)
.defPrim("=", EQ, 2, n)
.defPrim(">", GT, 2, n)
.defPrim(">=", GE, 2, n)
.defPrim("abs", ABS, 1)
.defPrim("acos", ACOS, 1)
.defPrim("append", APPEND, 0, n)
.defPrim("apply", APPLY, 2, n)
.defPrim("asin", ASIN, 1)
.defPrim("assoc", ASSOC, 2)
.defPrim("assq", ASSQ, 2)
.defPrim("assv", ASSV, 2)
.defPrim("atan", ATAN, 1)
.defPrim("bool?", BOOLEANQ, 1)
.defPrim("caaaar", CXR, 1)
.defPrim("caaadr", CXR, 1)
.defPrim("caaar", CXR, 1)
.defPrim("caadar", CXR, 1)
.defPrim("caaddr", CXR, 1)
.defPrim("caadr", CXR, 1)
.defPrim("caar", CXR, 1)
.defPrim("cadaar", CXR, 1)
.defPrim("cadadr", CXR, 1)
.defPrim("cadar", CXR, 1)
.defPrim("caddar", CXR, 1)
.defPrim("cadddr", CXR, 1)
.defPrim("caddr", THIRD, 1)
.defPrim("cadr", SECOND, 1)
.defPrim("call-with-current-continuation", CALLCC, 1)
.defPrim("call-with-input-file", CALLWITHINPUTFILE, 2)
.defPrim("call-with-output-file", CALLWITHOUTPUTFILE, 2)
.defPrim("car", CAR, 1)
.defPrim("cdaaar", CXR, 1)
.defPrim("cdaadr", CXR, 1)
.defPrim("cdaar", CXR, 1)
.defPrim("cdadar", CXR, 1)
.defPrim("cdaddr", CXR, 1)
.defPrim("cdadr", CXR, 1)
.defPrim("cdar", CXR, 1)
.defPrim("cddaar", CXR, 1)
.defPrim("cddadr", CXR, 1)
.defPrim("cddar", CXR, 1)
.defPrim("cdddar", CXR, 1)
.defPrim("cddddr", CXR, 1)
.defPrim("cdddr", CXR, 1)
.defPrim("cddr", CXR, 1)
.defPrim("cdr", CDR, 1)
.defPrim("char->integer", CHARTOINTEGER, 1)
.defPrim("char-alphabetic?",CHARALPHABETICQ, 1)
.defPrim("char-ci<=?", CHARCICMP+LE, 2)
.defPrim("char-ci<?" , CHARCICMP+LT, 2)
.defPrim("char-ci=?" , CHARCICMP+EQ, 2)
.defPrim("char-ci>=?", CHARCICMP+GE, 2)
.defPrim("char-ci>?" , CHARCICMP+GT, 2)
.defPrim("char-downcase", CHARDOWNCASE, 1)
.defPrim("char-lower-case?",CHARLOWERCASEQ, 1)
.defPrim("char-numeric?", CHARNUMERICQ, 1)
.defPrim("char-upcase", CHARUPCASE, 1)
.defPrim("char-upper-case?",CHARUPPERCASEQ, 1)
.defPrim("char-whitespace?",CHARWHITESPACEQ, 1)
.defPrim("char<=?", CHARCMP+LE, 2)
.defPrim("char<?", CHARCMP+LT, 2)
.defPrim("char=?", CHARCMP+EQ, 2)
.defPrim("char>=?", CHARCMP+GE, 2)
.defPrim("char>?", CHARCMP+GT, 2)
.defPrim("char?", CHARQ, 1)
.defPrim("close-input-port", CLOSEINPUTPORT, 1)
.defPrim("close-output-port", CLOSEOUTPUTPORT, 1)
.defPrim("complex?", NUMBERQ, 1)
.defPrim("cons", CONS, 2)
.defPrim("cos", COS, 1)
.defPrim("current-input-port", CURRENTINPUTPORT, 0)
.defPrim("current-output-port", CURRENTOUTPUTPORT, 0)
.defPrim("display", DISPLAY, 1, 2)
.defPrim("eof-object?", EOFOBJECTQ, 1)
.defPrim("eq?", EQQ, 2)
.defPrim("equal?", EQUALQ, 2)
.defPrim("eqv?", EQVQ, 2)
.defPrim("eval", EVAL, 1, 2)
.defPrim("even?", EVENQ, 1)
.defPrim("exact?", INTEGERQ, 1)
.defPrim("exp", EXP, 1)
.defPrim("expt", EXPT, 2)
.defPrim("force", FORCE, 1)
.defPrim("for-each", FOREACH, 1, n)
.defPrim("gcd", GCD, 0, n)
.defPrim("inexact?", INEXACTQ, 1)
.defPrim("input-port?", INPUTPORTQ, 1)
.defPrim("integer->char", INTEGERTOCHAR, 1)
.defPrim("integer?", INTEGERQ, 1)
.defPrim("lcm", LCM, 0, n)
.defPrim("length", LENGTH, 1)
.defPrim("list", LIST, 0, n)
.defPrim("list->string", LISTTOSTRING, 1)
.defPrim("list->vector", LISTTOVECTOR, 1)
.defPrim("list-ref", LISTREF, 2)
.defPrim("list-tail", LISTTAIL, 2)
.defPrim("list?", LISTQ, 1)
.defPrim("load", LOAD, 1)
.defPrim("log", LOG, 1)
.defPrim("macro-expand", MACROEXPAND,1)
.defPrim("make-string", MAKESTRING,1, 2)
.defPrim("make-vector", MAKEVECTOR,1, 2)
.defPrim("map", MAP, 1, n)
.defPrim("max", MAX, 1, n)
.defPrim("member", MEMBER, 2)
.defPrim("memq", MEMQ, 2)
.defPrim("memv", MEMV, 2)
.defPrim("min", MIN, 1, n)
.defPrim("modulo", MODULO, 2)
.defPrim("negative?", NEGATIVEQ, 1)
.defPrim("newline", NEWLINE, 0, 1)
.defPrim("not", NOT, 1)
.defPrim("null?", NULLQ, 1)
.defPrim("number->string", NUMBERTOSTRING, 1, 2)
.defPrim("number?", NUMBERQ, 1)
.defPrim("odd?", ODDQ, 1)
.defPrim("open-input-file",OPENINPUTFILE, 1)
.defPrim("open-output-file", OPENOUTPUTFILE, 1)
.defPrim("output-port?", OUTPUTPORTQ, 1)
.defPrim("pair?", PAIRQ, 1)
.defPrim("peek-char", PEEKCHAR, 0, 1)
.defPrim("positive?", POSITIVEQ, 1)
.defPrim("procedure?", PROCEDUREQ,1)
.defPrim("quotient", QUOTIENT, 2)
.defPrim("rational?", INTEGERQ, 1)
.defPrim("read", READ, 0, 1)
.defPrim("read-char", READCHAR, 0, 1)
.defPrim("real?", NUMBERQ, 1)
.defPrim("remainder", REMAINDER, 2)
.defPrim("reverse", REVERSE, 1)
.defPrim("round", ROUND, 1)
.defPrim("set-car!", SETCAR, 2)
.defPrim("set-cdr!", SETCDR, 2)
.defPrim("sin", SIN, 1)
.defPrim("sqrt", SQRT, 1)
.defPrim("string", STRING, 0, n)
.defPrim("string->list", STRINGTOLIST, 1)
.defPrim("string->number", STRINGTONUMBER, 1, 2)
.defPrim("string->symbol", STRINGTOSYMBOL, 1)
.defPrim("string-append", STRINGAPPEND, 0, n)
.defPrim("string-ci<=?", STRINGCICMP+LE, 2)
.defPrim("string-ci<?" , STRINGCICMP+LT, 2)
.defPrim("string-ci=?" , STRINGCICMP+EQ, 2)
.defPrim("string-ci>=?", STRINGCICMP+GE, 2)
.defPrim("string-ci>?" , STRINGCICMP+GT, 2)
.defPrim("string-length", STRINGLENGTH, 1)
.defPrim("string-ref", STRINGREF, 2)
.defPrim("string-set!", STRINGSET, 3)
.defPrim("string<=?", STRINGCMP+LE, 2)
.defPrim("string<?", STRINGCMP+LT, 2)
.defPrim("string=?", STRINGCMP+EQ, 2)
.defPrim("string>=?", STRINGCMP+GE, 2)
.defPrim("string>?", STRINGCMP+GT, 2)
.defPrim("string?", STRINGQ, 1)
.defPrim("substring", SUBSTRING, 3)
.defPrim("symbol->string", SYMBOLTOSTRING, 1)
.defPrim("symbol?", SYMBOLQ, 1)
.defPrim("tan", TAN, 1)
.defPrim("vector", VECTOR, 0, n)
.defPrim("vector->list", VECTORTOLIST, 1)
.defPrim("vector-length", VECTORLENGTH, 1)
.defPrim("vector-ref", VECTORREF, 2)
.defPrim("vector-set!", VECTORSET, 3)
.defPrim("vector?", VECTORQ, 1)
.defPrim("write", WRITE, 1, 2)
.defPrim("write-char", DISPLAY, 1, 2)
.defPrim("zero?", ZEROQ, 1)
///////////// Extensions ////////////////
.defPrim("new", NEW, 1)
.defPrim("class", CLASS, 1)
.defPrim("method", METHOD, 2, n)
.defPrim("exit", EXIT, 0, 1)
.defPrim("error", ERROR, 0, n)
.defPrim("time-call", TIMECALL, 1, 2)
.defPrim("_list*", LISTSTAR, 0, n)
;
return env;
}