by jamesbrock · 5y ago · 0 comments
> So far, the only programming language I know of that supports this type of crazy data transformations is JAI,
Haskell supports this type of data transformation.
http://hackage.haskell.org/package/vector-0.12.3.0/docs/Data...
> unboxed vectors of pairs are represented as pairs of unboxed vectors.
Why is that? They're perfectly fine for most purposes, and have the advantage that when you pass one across a function boundary the callee can play with it or modify it or do whatever the hell they want and when the callee returns, the caller's linked list is untouched. That's an incredibly valuable feature for correctness and safety.
> That's an incredibly valuable feature for correctness and safety.
Are you thinking of something else? That's an effect of call by value, but linked lists actually aren't good at that and you have to copy them to pass them around. You need something like these to make it efficient: