Dear GAP forum: Is it possible to include default arguments in a function?
Such as something like this (which doesn't work): add := function(a,b:=1) return a+b; end; So that add(2,2) = 4 and add(2) = 3. The only way I've managed to do is by writing: add := function(arg) if Size(arg) = 2 then return arg[1] + arg[2]; else return arg[1] + 1; fi; end; But if you have 2 or 3 (optional) arguments with default values this becomes cumbersome. Is there a more efficient way? Best, Kieran. _______________________________________________ Forum mailing list Forum@mail.gap-system.org http://mail.gap-system.org/mailman/listinfo/forum