# HG changeset patch # User Jaroslav Hajek # Date 1265712183 -3600 # Node ID c3df189b1b154ced10c22a7e343e4a5c76528da1 # Parent b178769f31ca007d2e26a62af7c4cd6feec3427e more coding tips diff -r b178769f31ca -r c3df189b1b15 doc/ChangeLog --- a/doc/ChangeLog Tue Feb 09 10:48:31 2010 +0100 +++ b/doc/ChangeLog Tue Feb 09 11:43:03 2010 +0100 @@ -1,3 +1,7 @@ +2010-02-09 Jaroslav Hajek + + * interpreter/tips.txi: More tips. + 2010-01-30 Jaroslav Hajek * interpreter/expr.txi (Assignment): Document return value of diff -r b178769f31ca -r c3df189b1b15 doc/interpreter/tips.txi --- a/doc/interpreter/tips.txi Tue Feb 09 10:48:31 2010 +0100 +++ b/doc/interpreter/tips.txi Tue Feb 09 11:43:03 2010 +0100 @@ -221,7 +221,7 @@ @item Use @code{cellfun} intelligently. The @code{cellfun} function is a useful tool for avoiding loops. @xref{Processing Data in Cell Arrays}. -@code{cellfun} is often use with anonymous function handles; however, calling +@code{cellfun} is often used with anonymous function handles; however, calling an anonymous function involves an overhead quite comparable to the overhead of an m-file function. Passing a handle to a built-in function is faster, because the interpreter is not involved in the internal loop. For example: @@ -235,6 +235,11 @@ @end example @item +Octave includes a number of other functions that can replace common types of loops, +including @code{bsxfun}, @code{arrayfun}, @code{structfun}, @code{accumarray}. +These functions can take an arbitrary function as a handle. + +@item Avoid calling @code{eval} or @code{feval} excessively, because they require Octave to parse input or look up the name of a function in the symbol table.