[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Matlab-style empty output/input arguments support
From: |
Olaf Till |
Subject: |
Re: Matlab-style empty output/input arguments support |
Date: |
Thu, 28 Jan 2010 10:14:46 +0100 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Wed, Jan 27, 2010 at 01:03:19PM +0100, Jaroslav Hajek wrote:
> ...
> So we can now do:
>
> octave:1> [~, y] = deal (1, 2);
> octave:2> who
> Variables in the current scope:
>
> ans y
>
> octave:3> y
> y = 2
> octave:4> f = @(~, y) disp (y)
> f =
>
> @(~, y) disp (y)
>
> octave:5> f(1, 2)
> 2
> octave:8> function a = g (x, ~, y = 1), a = x+y; endfunction
> octave:9> g(1,2,3)
> ans = 4
This looks very nice to me. Just my 2 cents from the users point of
view:
> Should
> [c,d] = [a,~] = myfun (...)
> simply raise an error?
An error (element number 2 undefined in return list) would seem
logical to me. But I think one should be able to do something like
[d, ~, f] = [a, ~, c] = myfun (...)
Olaf
Re: Matlab-style empty output/input arguments support, Jaroslav Hajek, 2010/01/29