-
Hi, how does dex plan to support graphs and trees and such? Can they be expressed as tables/index sets, and if so, would that be efficient? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
Oops, I should have searched:#526 (comment) Still, I'm generally curious about how far index sets can get us with non array like things |
Beta Was this translation helpful? Give feedback.
-
This is still an area of open exploration! @duvenaud has played with array-backed graphs in #526, as you noticed. There's also a longstanding dream of adding recursion and recursive algebraic data types like you get in conventional functional languages (#331) which are perfect for representing trees. In general, there's a lot of fun work to do in figuring out how to use Dex's primitives for sophisticated data structures in a way that's safe and parallel. Early functional programmers had to invent new data structure that worked in a functional setting, (see e.g. Chris Okasaki's book). We might find ourselves doing something analogous. |
Beta Was this translation helpful? Give feedback.
-
Here's a relevant issue too! We're planning to do some work on it this year (hopefully with @tscholak), but the timelines are still a bit unclear. |
Beta Was this translation helpful? Give feedback.
-
If you want another example, @chenzizhao wrote a few tree-based algorithms + datastructures in Dex. For example, Monte Carlo Tree Search: https://github.com/chenzizhao/dex-lang/blob/mcts/examples/mcts.dx It's still a bit awkward though, since we have to manually convert all recursion to while loops for the time being. |
Beta Was this translation helpful? Give feedback.
This is still an area of open exploration! @duvenaud has played with array-backed graphs in #526, as you noticed. There's also a longstanding dream of adding recursion and recursive algebraic data types like you get in conventional functional languages (#331) which are perfect for representing trees.
In general, there's a lot of fun work to do in figuring out how to use Dex's primitives for sophisticated data structures in a way that's safe and parallel. Early functional programmers had to invent new data structure that worked in a functional setting, (see e.g. Chris Okasaki's book). We might find ourselves doing something analogous.