Joerg Arndt on Sun, 10 Mar 2013 19:17:48 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: function defaults


* Charles Greathouse <charles.greathouse@case.edu> [Mar 10. 2013 08:11]:
> In cases like this I just write
> 
> foo(a=-1, b=-1)={
>   if(a==-1 || b==-1, error());
>   \\ code
> }
> 
> where -1, [], etc. is chosen as an argument which could not be valid for
> the function.

That's what I do.
However, one has always to come up with a value
that "doesn't make sense" (under any circumstances).
This may be impossible in some cases (if you argue that,
at the very least this approach is ugly).

> 
> Charles Greathouse
> Analyst/Programmer
> Case Western Reserve University
> 
> 
> [...]

jj