[VPM] Re: ADTs

Peter Scott Peter at PSDT.com
Sat Mar 8 13:12:21 CST 2003


At 11:40 AM 3/4/2003 -0800, nkuipers wrote:
>Hello,
>
>So I'm taking this course in data structures in Java.  For example, a java
>sequence inherits from vectors and lists, and iterators extend positions.
>Since my first language is Perl, this naturally has me thinking about ADTs in
>Perl.  I looked around CPAN for "ADT" and "List" and "Vector" and such, and
>was surprised at the apparent lack of Perl representations of such constructs.

Like you said later, they're not needed.  Lists and Vectors are for 
languages that don't have the polymorphic lists/arrays/hashes that Perl 
already has.

>  The closest thing I found was Class::Struct.  Now, I fully realize that
>between hashes and arrays, and the rich set of Perl built-ins (like splice),
>there isn't really a *need* for CPAN modular definitions of doubly linked
>lists and so forth.  But what if I don't want to program with fundamental
>types yet stick with Perl?  These abstractions make for easy programming and
>self-documenting code (at least for a maintainer or someone not too familiar
>with Perl), and I'm curious if I missed something on CPAN or if this simply
>isn't a Perl thing to do.  Perl includes the fundamental data types scalar,
>array, and hash, would it be appropriate to also include a selection of ADTs?

I'm not sure what more you want from an ADT that you think Perl doesn't 
provide, but it seems to me that the piece you're missing is operator 
overloading.  Look up overload.pm.  Between that and tie(), Perl gives you 
all the ADT-making capability that you could want.

Or are you asking where third-party ADTs are?  I think you'll find the 
greatest collection of them in PDL (Perl Data Language).

Cheers,

--
Peter Scott
peter at psdt.com
http://www.perldebugged.com




More information about the Victoria-pm mailing list