[
Lists Home |
Date Index |
Thread Index
]
- To: Michael Kay <mike@saxonica.com>
- Subject: Re: [xml-dev] Bad programmers use recursion (Offtopic was Re: [xml-dev]XML Performance in a Transacation)
- From: Rick Marshall <rjm@zenucom.com>
- Date: Mon, 27 Mar 2006 13:09:53 +1000
- Cc: "'Rick Jelliffe'" <rjelliffe@allette.com.au>, xml-dev@lists.xml.org
- In-reply-to: <200603261421.k2QELTdf005406@zmail.zenucom.com>
- Organization: Zenucom Pty Ltd
- References: <200603261421.k2QELTdf005406@zmail.zenucom.com>
- User-agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929)
guess i'm a youngster (only 3 decades experience) - but i still find
recursion essential - it works best as michael says on tree structures,
particularly with unknown depth. there's an elegance about it and a
reliability that is difficult to match. often with these problems what
you gain by not using recursive function calls you lose in state
maintenance. on the other hand there's nothing like a pointer to rapidly
digest text.
ps if you're worried about function calls, what about some good old
fashioned macros. in many cases you get the beauty of the function call
with the speed of inline. this can be very significant, but it sadly it
won't fix our o(n^2) problem.
rick
Michael Kay wrote:
>>On that subject, for text programming, the use of recursion is almost
>>always the sign of an inexperienced or poor programmer.
>>
>>
>
>Odd then that I find myself using recursion more and more as my programming
>career moves into its fourth decade. It's partly, of course, the result of
>exposure to functional programming languages: this often means that the
>recursive solution is the first thing you think of rather than the last.
>It's also partly because most code isn't performance-critical.
>
>But with the caveat "for text programming" I see your point: I find
>recursive code very natural when dealing with recursive data structures
>(trees) but less natural when dealing with linear data (sequences and
>strings).
>
>Michael Kay
>http://www.saxonica.com/
>
>
>
>-----------------------------------------------------------------
>The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
>initiative of OASIS <http://www.oasis-open.org>
>
>The list archives are at http://lists.xml.org/archives/xml-dev/
>
>To subscribe or unsubscribe from this list use the subscription
>manager: <http://www.oasis-open.org/mlmanage/index.php>
>
>
>!DSPAM:4426a36c54131896214748!
>
>
>
begin:vcard
fn:Rick Marshall
n:Marshall;Rick
email;internet:rjm@zenucom.com
tel;cell:+61 411 287 530
x-mozilla-html:TRUE
version:2.1
end:vcard
|