[Maxima] create_list makelist possible bugs
macrakis at alum.mit.edu
Tue Sep 9 07:50:04 CDT 2008
On Mon, Sep 8, 2008 at 8:35 PM, Robert Dodier <robert.dodier at gmail.com>
> (2) Are you really going to call inpart ? I don't know what you are trying
> to do, but part hacking is rarely necessary. If you just want the first
> and second arguments of expr, why not first(expr) and second(expr) ?
If expr is a list, then expr and expr are the best way to get its
first and second elements.
For non-list expressions, first(expr) and second(expr) are just synonyms for
part(expr,1) and part(expr,2) and share the disadvantage that they reformat
(nformat) the whole expression:
thru 100000 do part(qq,2) => 7.35 s
thru 100000 do inpart(qq,2)=> 0.54 s
thru 100000 do second(qq) => 7.44 s
For sophisticated users, inpart is much better.
Though it is tempting to optimize part so that it has its own private
partial nformat, that makes for very hard-to-maintain code if part is going
to remain completely aligned with the display of expressions (under a
variety of parameter settings), which it has to be.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Maxima