From: William P. Y. H. <wil...@gm...> - 2006-01-04 10:50:18
|
On 1/3/06, Alois Schloegl <alo...@tu...> wrote: > I prefer the recursive version. It gives cleaner and shorter code and > needs less temporary variables. > I see your point. Actually our point of views are different: you view it from the "cellstr as an extra functionality" viewpoint, while I view it from the "cellstr as a generalization of string" viewpoint. Well, I don't know, but I'm sometimes reluctant to do something recursively unless absolutely neccessary. And our approaches both have advantages and disadvantages. Your code's advantage is: char matrix is handled as fast as before; disadvantage: uses recursion. My code's advantage is: no recursion; disadvantage: char matrix is handled a bit slower. Actually there's another way to do it; I first thought of this idea, but later preferred my current code: handle char matrix and cellstr differently (like your code), but don't use recursion for cellstr. Instead, use a loop (like mine) for cellstr. This has the advantage that simple arguments (char matrices) are handled without loss of speed (inherited from your code) and that cellstr is handled without recursion (inherited from my code). The disadvantage is that the searching code is duplicated, which might cause maintenance problems later on. I still prefer my code, though :p > >>I'll check in the changes into Octave-forge. You can post it to > >>bug-octave and ask John to include it. > >> > source-octave (instead of bug-octave) would be more appropriate. > I've never posted to source-octave, and it seems that the list is very quie= t... -- William Poetra Yoga Hadisoeseno |