<div dir="ltr">Great, thanks for the tips guys. I will work on that and no doubt have questions later!<div><br></div><div>iain</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Aug 14, 2020 at 1:34 PM &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">I think you can mimic cl-store in s7; for example<br>
it&#39;s possible to call for-each on the repl&#39;s top let, omit functions <br>
that<br>
aren&#39;t interesting, and write the others using format with ~W or <br>
object-&gt;string<br>
with :readable.  In repl.scm the top let is (*repl* &#39;top-level-let), so <br>
say<br>
we started that repl and typed:<br>
<br>
&lt;1&gt; (define (f1 x) (+ x 1))<br>
f1<br>
&lt;2&gt; (define f2 (let ((y 3))<br>
                  (lambda (z)<br>
                    (+ y z))))<br>
f2<br>
<br>
Now we can save this to a file via:<br>
<br>
(call-with-output-file &quot;saved-repl.scm&quot;<br>
   (lambda (p)<br>
     (for-each<br>
       (lambda (var&amp;val)<br>
         (unless (eq? (car var&amp;val) &#39;exit)<br>
           (format p &quot;(define ~S ~W)~%&quot; (car var&amp;val) (cdr var&amp;val))))<br>
       (*repl* &#39;top-level-let))))<br>
<br>
The file has:<br>
<br>
(define f2 (let ((y 3)) (lambda (z) (+ y z))))<br>
(define f1 (lambda (x) (+ x 1)))<br>
<br>
This can be used for (almost) anything (I used the top-level-let<br>
above for simplicity).  You can use (*s7* &#39;file-names) to<br>
find what files need to be loaded.<br>
<br>
</blockquote></div>