[Haskell-beginners] Haskell laziness and data structures.

OxFord fordforox at gmail.com
Thu Jul 7 07:31:20 UTC 2016


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.

Is it safe to assume that ' reverse [1, 2, 3, 4, 5] ' is O(1) ?
Is it safe to assume that main =
x = [1, 2, 3, 4, 5]
x = reverse reverse x
won't use more space than for the initial [1, 2, 3, 4, 5] list? (No copy of
x)

Why is array indexeded by ! and list by !!. Shouldn't they be both
instances of something like Indexable?

King regards,

Ford
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160707/f5dcd53a/attachment.html>


More information about the Beginners mailing list