Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running time notes #172

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Data/Array.purs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
-- | `Data.Sequence` instead, which might give better performance for certain
-- | use cases. This module is useful when integrating with JavaScript libraries
-- | which use arrays, but immutable arrays are not a practical data structure
-- | for many use cases due to their poor asymptotics.
-- | for many use cases due to their poor asymptotics. The running time of all
milesfrain marked this conversation as resolved.
Show resolved Hide resolved
-- | array modification operations (`cons`, `snoc`, etc.) are at least as slow as
-- | `O(n)` because a copy of the array must be created to preserve immutability.
-- |
-- | In addition to the functions in this module, Arrays have a number of
-- | useful instances:
Expand Down Expand Up @@ -246,6 +248,7 @@ infixr 6 cons as :
-- | snoc [1, 2, 3] 4 = [1, 2, 3, 4]
-- | ```
-- |
-- | Note, the running time of this function is `O(n)`.
foreign import snoc :: forall a. Array a -> a -> Array a

-- | Insert an element into a sorted array.
Expand Down