- Function func = new Function (sym, args, body, this);
+ Function func = (Function) functions.Get (sym);
+
+ if (func != null)
+ {
+ int nargs = args == null ? 0 : args.Count;
+
+ if (func.min_arg < nargs || func.max_arg > nargs)
+ throw new Exception ("Incompatible argument numbers to override: "
+ + sym);
+ func.lambda.SetArgs (args);
+ func.lambda.SetBody (body, this);
+ func.builtin = null;
+ }
+ else
+ {
+ func = new Function (sym, args, body, this);
+ functions = functions.Cons (sym, func);
+ }
+ }
+
+ public void Defun (XmlNode node)
+ {
+ MSymbol sym = node.Attributes["id"].Value;
+ Function func = (Function) functions.Get (sym);