Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Art interface: cell and thunk are incomplete / broken #12

Open
matthewhammer opened this issue Jan 19, 2015 · 0 comments
Open

Art interface: cell and thunk are incomplete / broken #12

matthewhammer opened this issue Jan 19, 2015 · 0 comments

Comments

@matthewhammer
Copy link
Contributor

The Nominal Adapton interface is broken for functions cell and thunk. This is my fault. Kyle has been aware of this for a while, but we haven’t prioritized fixing it. Now, it’s biting Nick.

The problem is that both functions take a name, and then ignore it, rather than use it to memorize the art that they return, as they should do.

In the meantime, here’s a workaround that I used for AVL trees:
https://github.com/plum-umd/adapton.ocaml/blob/master/Source/adapton_structures/SpreadTree.ml#L1430

In particular, the function nm_tree creates a memo table that memoizes tree structures based on a name. It does something close to what cell should do.

Nick, I think you can adapt this code to get memo tables that are keyed on names. In particular, something like this:

  let mfn = MyArt.mk_mfn (Name.gensym "my_table") 
      (module MyData) 
      (fun r data -> data)
  in 
  fun nm data -> (mfn.MyArt.mfn_nart nm data)

That should give you a memo table where the same name yields the same thunk (physically).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants