core icon indicating copy to clipboard operation
core copied to clipboard

Dict: Add divideAndConquer helper.

Open showell opened this issue 6 years ago • 0 comments

This function will allow folks to do O(logN) traversals in some situations where the opaque nature of Dict currently would prevent those optimizations.

An example use case would be that you only want to render the visible portion of a line chart whose values were stored in a Dict.

As I mention in the docs, it's for advanced users.

Example usage:

example =
    [ ( 5, "fred" )
    , ( 6, "joe" )
    , ( 7, "mary" )
    , ( 8, "ann" )
    , ( 9, "bob" )
    , ( 10, "carl" )
    ]
        |> Dict.fromList

_ =
    Debug.log "hello" (Dict.divideAndConquer example)

yo =
    Debug.log "hello" (Dict.divideAndConquer Dict.empty)

showell avatar Nov 12 '19 12:11 showell