Arc Forumnew | comments | leaders | submitlogin
Anarki: tagged templates aren't hashes
2 points by bugger 3080 days ago | 3 comments
write-table for templates is broken on master.

  master:
  arc> (deftem x id 1)
  ((id #<procedure: g3929>))
  arc> (tablist (inst 'x))
  hash-for-each: contract violation
    expected: hash?
    given: '#(tagged tem (x #hash((id . 1)) #hash() . nil))
    argument position: 1st
    other arguments...:
     #<procedure: tablist>
    context...:
     ~/anarki/ac.scm:1125:15: maptable
      tablist
     ~/anarki/ac.scm:1233:4
Switched to a new branch 'stable'

  $ ./arc.sh 
  main: not defined or required into the top-level environment
  ./arc.sh: 40: [: Welcome: unexpected operator
  Use (quit) or ^D to quit, (tl) to return here after an interrupt.
  arc> (deftem x id 1)
  ((id #<procedure: gs1725>))
  arc> (tablist (inst 'x))
  ((id 1))
Looked around, didn't see a better way to fix this. Unsure how to add an appropriate unit test. Looked around, didn't see a better place to put this.

Thanks



3 points by akkartik 3079 days ago | link

Yeah, I had to change the implementation of templates several years ago to fix a bug: http://arclanguage.org/item?id=15664. There was no way to fix this without moving away from pure tables.

There's now a corresponding function called temlist: https://github.com/arclanguage/anarki/blob/7ae9fbc782/lib/te.... Does that work for you?

In general, the place to look for incompatible changes in anarki is the CHANGES directory, e.g. https://github.com/arclanguage/anarki/blob/80278a4002/CHANGE.... In this case you might need to jump to 3 different locations to make sense of things :/ Let me know if you still have questions, and that'll help me improve the documentation.

-----

2 points by bugger 3079 days ago | link

This should work. I see temstore now. Is there a parallel version of https://arclanguage.github.io/ref/template.html ?

Thanks!

-----

1 point by akkartik 3078 days ago | link

Sorry, there isn't :/ I'd love to have an anarki version of the arc reference, but for now there's only online help. Though you might need to look at tem.arc to know what to ask for help on.. :/

-----