Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Re: Recursion, tree parsing.

by jonadab (Parson)
on Apr 15, 2003 at 01:48 UTC ( [id://250447]=note: print w/replies, xml ) Need Help??


in reply to Re: Recursion, tree parsing.
in thread Recursion, tree parsing.

Some of those data structures that you never notice, the reason that you never notice them being coded up in Perl is because they don't have to be coded up by hand; Perl has stuff that accomplishes the same thing without a lot of extra work. Linked lists are a perfect example. Nobody _needs_ to code up linked lists in Perl, because Perl isn't so primitive as C. Perl isn't Lisp, but it has more builtin list-processing stuff than C. C programmers find them using linked lists sometimes when they don't know the length of an array at compile time; we don't need that sort of kludge in Perl because arrays are dynamic in length. We also don't need them for most of the other things they're used for in C (e.g., inserting items in the middle), because again Perl already has enough power to do stuff like that without the extra help. Linked lists are also used to implement stacks sometimes, but Perl just uses arrays for that. That's what we have push and pop for, after all. Trees you will occasionally see in Perl, though; I think there are a CPAN module or two for working with them. But there is one major use of trees that you won't see much in Perl: they're often used for sorting and searching, and Perl programmers are more likely to use hashes for that, or the builtin sort primitive, or both together, or throw it all in a database and use DBI. But trees are generally useful, so you will see them used sometimes for other things, as well as directed and undirected graphs occasionally

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://250447]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-26 01:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found