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