top | item 14535002

(no title)

inconvergent | 8 years ago

I'm not sure about how you would efficiently do this. (I'm not experienced with pure functional programming.) cloning the entire structure for every applied function sounds like it will be slow? is that not what you will have to do in practice?

i basically want the alterations to change the data structure, and i want them to do it according to a particular priority eventually. atm there is no priority ordering.

i can already make (almost) arbitrary functions, but you have to register them ahead of time, and they have to follow a particular pattern: http://inconvergent.net/arbitrary-alterations/. this is so that i can control the order in which they are applied, eventually.

discuss

order

pka|8 years ago

> cloning the entire structure for every applied function sounds like it will be slow? is that not what you will have to do in practice?

In short, no - as an example, when an element is added to an immutable map, a big part of the newly produced map is structurally shared with the old one (check out [0].)

As for the ordering, you could have a list of geometry -> geometry functions. You could then take the initial geometry and apply the list of functions in order, or a permutation of it, or drop some functions, or apply some others multiple times, and so on.

But anyway, it's just an idea - thinking in terms of atomic geometry transformations instead of alternations may or may not be easier in more complex scenarios, I don't know :)

[0] http://hypirion.com/musings/understanding-persistent-vector-...

inconvergent|8 years ago

this link looks interesting, thanks.