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

Hmm. Maybe a better generalization is to take advantage of this code in ac.scm:

   (define (ar-tagged? x)
     (and (vector? x) (eq? (vector-ref x 0) 'tagged)))
annotate creates a vector with 3 entries:

  (annotate 'foo (fn () nil))
  => #3(tagged,foo,<procedure>)
Let's then create a basic function which retains the type in the second entry of the vector, but adds a fourth entry containing a hash.

  (attach '= (fn (v) (settercode v))
    (fn () (readercode)))
  => #4(tagged,fn,<procedure>,#hash((= . <procedure>)))
The benefit here is we could add other aspects of the object - for example, getting a length, or determining the keys so we can traverse the object.

Hmm. Might actually implement this. Am planning a persistent table, such that assignments to persistent-table!key will automatically update a file on the server (which, incidentally, can also encapsulate a database instead)