[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Function-pointer - function as argument for functions
From: |
John W. Eaton |
Subject: |
Re: Function-pointer - function as argument for functions |
Date: |
Mon, 1 May 2000 04:05:42 -0500 (CDT) |
On 2-May-2000, Paul Kienzle <address@hidden> wrote:
| So, wouldn't it be cool if Octave had argument defaulting a la S? E.g.,
|
| function [a,b] = spectrogram(x, fs=8000, step=30, window=60)
| if nargin == 0, usage(spectrogram(x,fs=,step=,window=); endif
| endfunction
|
| spectrogram(x, step=25);
This has been discussed a number of times. I think it would be a nice
feature, but the syntax you mention won't work because in Octave (as
in C) assignments are expressions that produce values, so the step=25
in your function call would be ambiguous.
Something like
spectrogram (x, step := 25)
would probably work though.
I don't think there is a problem with using plain `=' for the function
definition, but it seems to me that it might as well be consistent
with the syntax that is used for the function call, so I would suggest
using `:=' there too.
jwe
-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.che.wisc.edu/octave/octave.html
How to fund new projects: http://www.che.wisc.edu/octave/funding.html
Subscription information: http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Function-pointer - function as argument for functions,
John W. Eaton <=