<div dir="ltr">Thanks !<br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-07-07 19:05 GMT+02:00 Marcin Mrotek <span dir="ltr"><<a href="mailto:marcin.jan.mrotek@gmail.com" target="_blank">marcin.jan.mrotek@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Hello,<br>
<br>
> Why is there no default O(1) random access list data structure in haskell<br>
> (for example clojure has [] vector). I would expect that this kind of data<br>
> structure is used very often, so you shouldn't need to import one yourself.<br>
<br>
</span>Vector (<a href="https://hackage.haskell.org/package/vector" rel="noreferrer" target="_blank">https://hackage.haskell.org/package/vector</a>) can be considered<br>
standard for all intents and purposes; it's one of the core libraries<br>
(<a href="https://wiki.haskell.org/Library_submissions#The_Libraries" rel="noreferrer" target="_blank">https://wiki.haskell.org/Library_submissions#The_Libraries</a>).<br>
Containers in Haskell are in general imported as libraries, it's no<br>
different than Map, Set, or Sequence, for example. I'm not sure if<br>
it's used all that often in Haskell - it's excellent for numeric code,<br>
or other cases when one just needs a big dumb block of data (though<br>
streaming with pipes or conduit might be a better solution in some<br>
cases), but for otherwise something like IntMap or Sequence might be<br>
more useful.<br>
<span class=""><br>
>Why is array indexeded by ! and list by !!. Shouldn't they be both instances of something like Indexable?<br>
<br>
</span>Indexing a list is O(n) and generally a bad idea. Proliferating type<br>
classes just to cover the rare use case of code that is indifferent to<br>
whether the indexing is done in O(n) or O(1) seems pointless to me.<br>
<br>
Best regards,<br>
Marcin Mrotek<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</div></div></blockquote></div><br></div>