Arc Forumnew | comments | leaders | submitlogin
1 point by almkglor 6022 days ago | link | parent

IIRC (annotate 'foo (annotate 'foo obj)) is different from (annotate 'foo obj); each annotate adds another layer of (rep ...) to peel off.

http://arclanguage.com/item?id=3692



2 points by absz 6022 days ago | link

Yes, but. That only holds if in (annotate t1 (annotate t2 data)), we have (isnt t1 t2) (there was a thread about this somewhere, but I can't find it). Try it!

  arc> (annotate 'foo (annotate 'bar obj))
  #3(tagged foo #3(tagged bar #3(tagged mac #<procedure>)))
  arc> (annotate 'foo obj)
  #3(tagged foo #3(tagged mac #<procedure>))
  arc> (annotate 'foo (annotate 'foo obj))
  #3(tagged foo #3(tagged mac #<procedure>))
I was surprised too; that's why this was a bug I had to fix. I suppose this behaviour makes sense, but it does break the second of the two identities

  (is (type (annotate t r)) t)
  (is (rep  (annotate t r)) r)
for certain values of r. Ah well.

-----

1 point by almkglor 6022 days ago | link

Huh. Have you tried it on PG's ArcN? It might have been me hacking this onto Anarki (I have multiple personalities. No, don't believe what I just said, that wasn't me. LOL). Don't have access to an arc right now, sorry ^_^

-----

2 points by almkglor 6022 days ago | link

Ah, it seems you're right ^^ From canonical arc:

  (define (ar-tag type rep)
    (cond ((eqv? (ar-type rep) type) rep)
          (#t (vector 'tagged type rep))))

  (xdef 'annotate ar-tag)

-----