octave-maintainers
[Top][All Lists]
Advanced

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

Re: functions with 'named' arguments


From: John W. Eaton
Subject: Re: functions with 'named' arguments
Date: Thu, 27 Mar 2008 15:39:36 -0400

On 21-Mar-2008, Dupuis wrote:

| This means:
| 1) arguments are either positionnal or named, without anything special at
| the function definition
| 2)  foo = function(a, b) {
| + print(a);
| + print(b);
| + }
| foo(b=3) => error message, a is missing and no default value given
| foo(b=3, a=2) => disp a then b
| foo(b=3, a=2, b=5) => error: formal argument b corresponding to more than
| one input argument 
| 
| Finally, about the nargin: there should be something equivalent, but I still
| didn't find where. 
| Here are some examples of R calls:
| 
http://blog.moertel.com/articles/2006/01/20/wondrous-oddities-rs-function-call-semantics

Does R provide the equivalent of a nargin function?  If not, maybe
this is the reason?  If it does, then how does it work, and would it
be compatible with what Octave and Matlab currently do?

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]