Skip to content

Discussion: nested adaptive values #93

@iamim

Description

@iamim

I previously asked open questions like this one in the Discord channel (thank you all for helping me out :) ) but I feel like placing it here might help other people too.

I'm interested in distributing the results of an incremental computation from the server to the client. To give a concrete example, suppose that the output of a computation is a table with a dynamic number of columns represented by the data structure HashMap<rowkey, HashMap<colkey, double>>. Now to broadcast it to the client I could diff the rows efficiently since the outer map will be an amap and I get efficiently calculated deltas that are a part of computation for free. However, diffing the inner map is more tricky. It feels somewhat wasteful to diff 2 HashMap to get a HashMapDelta. Ideally, these deltas were already computed and I could simply extract them.

How to structure such a computation is also not entirely clear to me. I could not find a solution for how to represent an amap<'a, amap<'b, 'c>>. If I understand it correctly, it's not possible since the only ElementOperations available to us are Set and Remove.

How do you approach such a structure? Going back to the example above, it's clear that column and row indices could be merged into a tuple and everything would be fine. But in general, it may not always be achievable or natural for the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions