help-octave
[Top][All Lists]
Advanced

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

set no value to []?


From: Daniel Heiserer
Subject: set no value to []?
Date: Mon, 06 Nov 2000 09:04:29 +0100

Hi,

Despite matlab incompatibility and  
incompatibiltiy to current m-files
is there  another reason for not
setting values of a function which
are undefined to []?


Assume I have a function
#----
function [o1,o2,o3,o4]=django_1(i1,i2,i3,i4)
#....
#------

And I want to call it whith lets say no value for i2.
Currently I have to mess around with nargin and so on.
But if I want to be able to call this function 
with no i2 OR no i3 and the parameters are of the same
type it is hard to impossible to distinguish if I tried to
call without i2 or i3.

Assume omitting i2 gives no result for o2 and omitting
i3 gives no result for o3:
I think it would be MUCH cleaner then to call the function 
then like
[o1,,o3,o4]=django_1(i1,,i3,i4);
   --                  --

and set the value i2 then implicitly inside the function django_1
to [];

The return value of o2 could be [] as well if I didn't define it.
Or lets say it is just 'undefined'.
I think that would make the code much much cleaner.

Any comments?

How hard would it be to implement that?
Would it make sense to have a flag like 
implicitly_undef=true
to invoke this capability or not?

thanks daniel



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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