octave-maintainers
[Top][All Lists]
Advanced

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

Re: cleaning up pkg.m


From: c.
Subject: Re: cleaning up pkg.m
Date: Fri, 16 Mar 2012 17:47:01 +0100

On 14 Mar 2012, at 18:50, Rik wrote:

> I think you could also use the fact that many of the string functions will 
> operate on char arrays or cell arrays of strings.  For example, the 
> isautoload function.
> 
> function auto = isautoload (desc)
>   auto = false;
>   if (isfield (desc{1}, "autoload"))
>     a = desc{1}.autoload;
>     if ((isnumeric (a) && a > 0)
>         || (ischar (a) && (strcmpi (a, "true")
>                          || strcmpi (a, "on")
>                          || strcmpi (a, "yes")
>                          || strcmpi (a, "1"))))
>       auto = true;
>     endif
>   endif
> endfunction
> 
> The second bit of this could be simplified quite a bit with
> 
> ischar (a) && any (strcmpi (a, {"true", "on", "yes", "1"}))

After the change you describe above, isautoload becomes quite trivial
so I thought it can be removed alltogether. Any objections to the attached 
patch?
c.

Attachment: open_HZva6Z9Y.txt
Description: Text document




reply via email to

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