|
From: | David Bateman |
Subject: | Re: Kind of a lookfor function |
Date: | Mon, 30 May 2005 17:39:28 +0200 |
User-agent: | Mozilla Thunderbird 0.8 (X11/20040923) |
Keith Goodman wrote:
This not a complete implementation of lookfor. Try this with "lookfor inverse" and it won't give you the pinv function for example. It should be easy enough to implement the function as is within octave itself without calling outside. However, a compatiable lookfor function that searchs in the text of the help (or at least the first line of the help) within octave would be more problematic. The reason is that internal to octave reading the help will force the function to be loaded, so this will be slow, and it will fill the memory with functions that are loaded but not used. So to do this properly the octave help code would need to be modified such that a call for the help of an unloaded function would load, read the help and then unload the function. This then breaks a nice little debugging trick for oct-files, where you can run octave in gdb, call the help of an oct-file and then type ctrl-c to return to gdb and since the oct-file is now loaded set a breakpoint within it.. I'd not like to that functionality as it is to useful, though there is probably a way around this in that help might not unload the function but lookfor would... Ok all of this is not impossible, or even that difficult, but its a bit of a pain.On 5/30/05, avraham <address@hidden> wrote:The ultimate in confort would be to make it an octave command, using the mark_as_command option, but I don't know how to do it. In fact, I don't know if this is possible at all. I would be glad if someone would explain how it could be done, or why it can't.I like your hack. function lookfor(target) disp(system(["Olookfor " target])); I added the following to my ~/.octaverc: mark_as_command lookfor Going outside of Octave means we'll never get this function back into Octave (as in part of an Octave release). If we can isolate the functionality that Octave doesn't provide (getting the output of help) and write the rest in Octave code, then maybe someone would replace the missing part with an Octave equivalent. Then we would increase of chances of adding lookfor to Octave A bonus feature would be a search of the help text. Now that you've given us a list of the function names, that shouldn't be hard. But it might be slow.
The fact is the example above can easiliy be found with google with a search "site:octave.sourceforge.net/index inverse" as the category index in octave-forge has the help of all of the octave and octave-forge functions included. So given the above problems I'm not sure its worth implementing lookfor.
Regards David -- David Bateman address@hiddenMotorola Labs - Paris +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax) 91193 Gif-Sur-Yvette FRANCE
The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary
------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------
[Prev in Thread] | Current Thread | [Next in Thread] |