[elm-discuss] Re: Array map with start and end

2017-11-17 Thread Robin Heggelund Hansen
Slicing isn't O(N). In the current implementation in core, slicing is O(log32n) i believe. In the next version of Elm, slicing is O(log32n) when start = 0; I'm uncertain what the big-o notation is once start > 0 though. fredag 17. november 2017 09.25.22 UTC+1 skrev Francisco Ramos følgende: >

[elm-discuss] Array map with start and end

2017-11-17 Thread Francisco Ramos
Hi there, Was wondering how I can map over an array with a start and end indexes. I know I could slice the array and then map, but performance is a concern and slicing is O(N) where N = end - start, plus the actual mapping, another O(N). Maybe there is another way where I just loop once over

[elm-discuss] Re: Array map with start and end

2017-11-17 Thread 'Rupert Smith' via Elm Discuss
On Friday, November 17, 2017 at 8:25:22 AM UTC, Francisco Ramos wrote: > > Hi there, > > Was wondering how I can map over an array with a start and end indexes. I > know I could slice the array and then map, but performance is a concern and > slicing is O(N) where N = end - start, plus the

Re: [elm-discuss] Re: Array map with start and end

2017-11-17 Thread Francisco Ramos
That was a good observation, Rupert. Well, it doesn't return Nothing if the indexes are out of the bounds, but if start < 0 then start = 0, and end >= length then end = length -1... I could actually use Array.get and implement my own map like you mention. Thanks Robin for that correction. I

[elm-discuss] Decoding a json property with different types of values

2017-11-17 Thread Thiago Temple
I have situation where I have to a jso object similar to this { "level": 1, "displayValue": "some text", "dataValue": "a string with the value" } { "level": 1, "displayValue": "some text", "dataValue": { "name": "xxx", "scope": "" } } Both cases for dataValue are valid, it can either have

[elm-discuss] Re: Array map with start and end

2017-11-17 Thread Rémi Lefèvre
Hi, Does using Array.indexedMap suit you? import Array exposing (Array) submap : Int -> Int -> (a -> a) -> Array a -> Array a submap start end func = Array.indexedMap (\i -> if i >= start && i < end then func else identity) Of course the result must be of the same type in this case. On

[elm-discuss] Elm-make failing when path has spaces

2017-11-17 Thread Thiago Temple
I have an existing application and I'm trying to add Elm to it. The problem is that the existing application already has a folder structure and one of the folders has a space in it. So when saving a file using vscode I see the following error:

[elm-discuss] Re: What build system do you prefer for Elm?

2017-11-17 Thread Tommy Messbauer
I use webpack 3. I made a component starter for webpack and then included it in an app starter. App starter included below and it uses elm-github-install b/c I need to include shared code from private repos. You might just want the webpack config. Advantages: webpack can be a nightmare, but

Re: [elm-discuss] Arbitrary length currying

2017-11-17 Thread Adrian Roe
I’m pretty certain you can’t do this in elm. The ellie is for f [] and f [3,9,2] whereas the question is for f [] and f [3] [9] [2] [] In the latter example, you need f [] to return an integer and f [3] to return a function that takes two lists of integers and a list of any type and returns

Re: [elm-discuss] Elm-make failing when path has spaces

2017-11-17 Thread Aaron VonderHaar
Hi! This looks like a bug in the VSCode plugin; elm-make and elm-format can both handle paths with spaces, so I suspect the VSCode plugin is not properly quoting the arguments. Does anyone familiar with the plugin have time to take a look at it? On Nov 17, 2017 7:19 AM, "Thiago Temple"

Re: [elm-discuss] Decoding a json property with different types of values

2017-11-17 Thread Aaron VonderHaar
The simplest approach would be to use Json.Decode.oneOf along with Json.Decode.map: dataValueDecoder : Json.Decode.Decoder DataValue dataValueDecoder = Json.Decode.oneOf [ Json.Decode.string |> Json.Decode.map Val , ... decode your KeyType record ... |> Json.Decode.map Key

Re: [elm-discuss] Re: Randoms as LazyLists

2017-11-17 Thread W. Gordon Goodsman
Looks like this version of lazy-list and even lazy itself have been depreciated, thus my PR is closed. I also looks like the recommended non-memoizing version of lazy-list has the same memory leaks for very long (infinite) lists, and thus needs my PR applied to it. The rational to depreciating

[elm-discuss] timeout in unit test

2017-11-17 Thread Max Goldstein
No, there is no way to do this currently. You can open an issue on GitHub if you want to discuss further. -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to