octave-maintainers
[Top][All Lists]
Advanced

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

nthoutarg function?


From: Jordi Gutiérrez Hermoso
Subject: nthoutarg function?
Date: Fri, 14 Oct 2011 00:27:18 -0500

This blog post got me thinking:

    http://abandonmatlab.wordpress.com/2010/05/28/multiple-output-arguments/

The blogger is quite right that multiple output arguments are a
problem. They require temporaries, and this makes for some slightly
brittle code.

It's not difficult to implement a generalisation of the
"2nd_output_of" function:

    function out = nthoutarg(fun, n, varargin)
      outargs = cell (1,n);
      [outargs{1:end-1}, out] = fun (varargin{:});
    endfunction

Should this function be part of Octave? I'm all for prettifying the
language as much as possible.

What do you think?

- Jordi G. H.


reply via email to

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