Re: [Ur] Arrays and maps?

2017-08-10 Thread Adam Chlipala
On 07/25/2017 11:48 AM, Artyom Shalkhakov wrote: Well, arrays may be overused and such, but here in this particular instance: https://github.com/ashalkhakov/urweb-projects/blob/master/sam/app.ur#L238 The update requires rebuilding the whole list, seems quite wasteful for this particular usage.

Re: [Ur] Arrays and maps?

2017-07-25 Thread Artyom Shalkhakov
2017-07-25 1:46 GMT+06:00 Aistis Raulinaitis : > I agree, I think arrays are much overused in programming for the most part. > My thoughts on are that these libs should facilitate easier interop with the > existing JS libs rather than as a bedrock for a data structure on the > frontend. On the othe

Re: [Ur] Arrays and maps?

2017-07-25 Thread Ziv Scully
*tl;dr*: use modules and functors, not typeclasses. Unlike Haskell, Ur/Web allows local typeclass instances. This means (for concreteness, focusing on binary trees—similar for other examples) we can't rely on being passed the same ord typeclass dictionary every time we call a tree function. Instea

Re: [Ur] Arrays and maps?

2017-07-24 Thread Aistis Raulinaitis
I agree, I think arrays are much overused in programming for the most part. My thoughts on are that these libs should facilitate easier interop with the existing JS libs rather than as a bedrock for a data structure on the frontend. On the other hand, I like the idea of a finger tree implementation

Re: [Ur] Arrays and maps?

2017-07-23 Thread Artyom Shalkhakov
2017-07-23 0:15 GMT+06:00 Benjamin Barenblat : > On Sat, Jul 22, 2017 at 11:59 AM, Artyom Shalkhakov > wrote: >> Is it possible to extend Ur/Web with arrays and maps? > > If you really want an array, I think you’re stuck with the FFI. However, > if you just want a bag and amortized runtimes are go

Re: [Ur] Arrays and maps?

2017-07-23 Thread Adam Chlipala
Yes, it's possible in principle to add such things to the standard library. However, the rarity with which such a feature is requested provides evidence that it's not important enough to build in! Benjamin Barenblat's suggestions of functional data structures seem good; most applications will

Re: [Ur] Arrays and maps?

2017-07-22 Thread Benjamin Barenblat
On Sat, Jul 22, 2017 at 11:59 AM, Artyom Shalkhakov wrote: > Is it possible to extend Ur/Web with arrays and maps? If you really want an array, I think you’re stuck with the FFI. However, if you just want a bag and amortized runtimes are good enough, you should implement a finger tree. You lose s