<div dir="ltr">Thanks Bill, that gives me a bunch more to chew on. <div><br></div><div>As part of my documentation for Scheme For Max, I plan on writing a page &quot;S7 for people coming from Clojure&quot;. When I do so I will be sure to check here to make sure I present things accurately. :-)</div><div><br></div><div>iain</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jun 6, 2020 at 7:34 AM &lt;<a href="mailto:bil@ccrma.stanford.edu">bil@ccrma.stanford.edu</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">My understanding of the transactional memory stuff was that it was a way<br>
to simplify multithreaded programs.  When I had within-s7 threads, I <br>
found<br>
they were slow because of contention for the heap and whatnot, and<br>
using multiple s7 interpreters instead was faster and simpler (from<br>
s7&#39;s point of view, of course).  My thought was that thread-global<br>
variables could be handled through a traditional data base -- I think<br>
the libgdbm example in s7.html touches on this.<br>
<br>
The immutable! function sets its argument immutable, so I think<br>
almost anything in s7 can be marked as immutable (you can also<br>
use a setter function).  It&#39;s not automatic, but you could<br>
obviously make it a local convention:<br>
<br>
(define (make-immutable-vector len)<br>
   (immutable! (make-vector len)))<br>
<br>
A lot of the metadata info in clojure is also supported in s7, but<br>
under a different set of names:  setter, documentation, signature, <br>
arity,<br>
and funclet for function definition location, argument list and source.<br>
Each function or c-object also has a local let that can<br>
contain arbitrary info under arbitrary names.  I haven&#39;t<br>
implemented that for sequences, but you could implement it<br>
in scheme by using the sequence&#39;s setter function&#39;s closure<br>
(a kludge, but it should work).<br>
<br>
;;; a function with user-defined metadata:<br>
(define func<br>
   (let ((my-special-info &quot;hi&quot;))<br>
     (lambda (x)<br>
       (+ x 1))))<br>
<br>
((funclet func) :my-special-info) -&gt; &quot;hi&quot;<br>
<br>
;;; use define-constant to define an immutable function<br>
<br>
;;; a vector with user-defined metadata<br>
(define vct<br>
    (let ((v (make-vector 23)))<br>
      (set! (setter &#39;v)<br>
            (let ((my-info &quot;ho&quot;))<br>
              (lambda (s v)<br>
                v)))<br>
      (immutable! v)))<br>
<br>
(immutable? vct) -&gt; #t<br>
(vector-set! vct 0 32) -&gt; error: can&#39;t vector-set! ... (it is immutable)<br>
((funclet (setter vct)) :my-info) -&gt; &quot;ho&quot;<br>
<br>
I need to look at clojure more closely -- I probably<br>
misunderstand the argot.<br>
<br>
<br>
</blockquote></div>