Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: Does perl6 have a native linked-list data type?

by moritz (Cardinal)
on Nov 18, 2010 at 08:48 UTC ( #872157=note: print w/replies, xml ) Need Help??


in reply to Re^2: Does perl6 have a native linked-list data type?
in thread Does perl6 have a native linked-list data type?

And since Perl6 i supposed to have a very flexible syntax, it shouldn't be too difficult to adapt map, grep and other similar functions in an efficient way without hardcoding linked lists in C.

That's correct, but I honestly don't understand the point. If you want lists, you just use the built-in lists. In Perl you'd use CONS/Pair only to build more complex data structures, like trees. And if you use that kind of flexibility, a generally overloaded map or grep isn't of much use anymore.

I've heard there are applications where you need to often insert or remove items from the middle of a list, but somehow I've never needed it in my own code. If I did, the proper perlish way would be o provide an alternative to the Array type, which also implements the Positional role. It would be usable just like an Array, except with different performance charateristics.

  • Comment on Re^3: Does perl6 have a native linked-list data type?

Replies are listed 'Best First'.
Re^4: Does perl6 have a native linked-list data type?
by perl5ever (Pilgrim) on Nov 22, 2010 at 00:02 UTC
    ... That's correct, but I honestly don't understand the point. If you want lists, you just use the built-in lists. ...
    The polymorphism would be useful. Sometime you don't care about the implementation - you just need an object which has some of the properties of an array (like the ability to perform map and grep on it.) In that case you can return a real array or a chain of CONS cells whichever is most convenient.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://872157]
help
Chatterbox?
[ambrus]: but yes, typically native English speakers, who think that English is still their exclusive property, are the worst.
[LanX]: Eily: do you live in an English speaking country?
[LanX]: I think foreigners tend to simplify their phrases, whereby often native speakers don't know how to adapt
[Eily]: nope, France
[LanX]: That's pretty true for every language
[LanX]: so don't worry, anyway most spoken language in the world is broken English
LanX (especially in the streets of Singapore)
[Eily]: yes I know, native English speakers are actually a minority among English speakers :)

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (12)
As of 2017-03-27 16:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.