octave-maintainers
[Top][All Lists]
Advanced

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

Re: How to check for availability of functions in core octave


From: PhilipNienhuis
Subject: Re: How to check for availability of functions in core octave
Date: Fri, 29 Jul 2011 12:02:57 -0700 (PDT)

bpabbott wrote:
> 
> On Jul 29, 2011, at 2:32 PM, PhilipNienhuis wrote:
> 
>> Is there a user-function for checking if some function is present in core
>> Octave?
>> Something like  
>>  isimplemented ("erfcx")
>> ?
>> 
>> I'm looking at pkg.m to see if some check can be implemented there to
>> skip
>> copying m-files for which equivalent (and probably better) functionality
>> is
>> in core octave. This is somewhat motivated by:
>> 
>>   http://sourceforge.net/mailarchive/message.php?msg_id=26792800
>> 
>> and some experiences with maintenance of octave-forge packages.
>> 
>> Philip
> 
> Does this do what you want?
> 
>>> isimplemented = @(fun) exist (strcat(fun,".m")) == 2 || exist (fun) > 2;
>>> isimplemented ("residue")
> ans =  1
>>> isimplemented ("erfcx")
> ans =  1
> 
> Ben
> 

Almost, Ben, a good first try, thanks.

But... your example also picks up functions in octave-forge:

octave.exe:4> isimplemented = @(fun) exist (strcat(fun,".m")) == 2 || exist
(fun) > 2
isimplemented =

@(fun) exist (strcat (fun, ".m")) == 2 || exist (fun) > 2

octave.exe:5> isimplemented ("residue")
ans =  1
octave.exe:6> isimplemented ("xls2oct")
ans =  1

(xls2oct.m is in the OF io package)

Even worse, it picks up OF functions shadowing core functions:

GNU Octave, version 3.4.2
Copyright (C) 2011 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type `warranty'.
<snip>
warning: function
C:\Programs\Octave\3.4.2\share\octave\packages\specfun-1.0.9\erfcx.m sha
dows a built-in function
:
<further down>
:
octave.exe:7> isimplemented ("erfcx")
ans =  1
octave.exe:8>


My question is really aimed at detecting stuff in core Octave, regardless of
whether it is shadowed or not (yes an extra requirement coming out of the
blue, now that there's something I could try).

Philip

--
View this message in context: 
http://octave.1599824.n4.nabble.com/How-to-check-for-availability-of-functions-in-core-octave-tp3704954p3705027.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.


reply via email to

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