octave-maintainers
[Top][All Lists]
Advanced

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

Re: mapper functions vs. cell arrays


From: David Bateman
Subject: Re: mapper functions vs. cell arrays
Date: Fri, 01 Sep 2006 12:44:38 +0200
User-agent: Thunderbird 1.5.0.5 (X11/20060817)

John W. Eaton wrote:
> On 31-Aug-2006, David Bateman wrote:
>
> | John W. Eaton wrote:
> | > Should we be bug-for-bug compatible here, or should we do something
> | > that is more consistent?  I think we should do one of the following:
> | >
> | >   * Change all the mapper functions so that
> | >
> | >       mapper (CELL) == cellfun (@MAPPER, CELL)
> | >
> | >   
> | I prefer this solution. Programs that work in matlab then work in octave
> | and we have a consistent interface...
>
> OK.
>
> Well, the current implementation of cellfun in Matlab is more complex
> than what we have in Octave.  For example,
>   
They copied us, when cellfun in octave-forge was implemented the matlab
cellfun couldn't take arbitrary functions, and was very simple. It seems
to me when matlab implements a feature that octave has, they never do
exactly the same but must change it in some way.

> Matlab gives an error for this
>
>   cellfun (@upper, {'foo'; 'foobar'})
>
> but not this
>
>   cellfun (@upper, {'foo'; 'foobar'}, 'UniformOutput', false)
>
> and both of these
>
>   cellfun (@upper, {'f', 'o', 'o'})
>   cellfun (@upper, {'f', 'o', 'o'}, 'UniformOutput', true)
>
> return
>
>   "FOO"
>
> while
>
>   cellfun (@upper, {'f', 'o', 'o'}, 'UniformOutput', true)
>
> returns a cell array of characters.
>
> There is also a new ErrorHandler parameter that allows one to specify
> a function to call if the mapper fails.
>
> Ugh.  Is there any function in Matlab that is not aqcuiring a lot of
> twisty little features?
>   

The multiple input/output  argument stuff of the matlab cellfun seems
fairly easy to implement. The other two args I'm not  sure I fully see
there value..

D.


> jwe
>
>   


-- 
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



reply via email to

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