<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 <<a href="mailto:bil@ccrma.stanford.edu">bil@ccrma.stanford.edu</a>> 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's possible to call for-each on the repl's top let, omit functions <br>
that<br>
aren't interesting, and write the others using format with ~W or <br>
object->string<br>
with :readable. In repl.scm the top let is (*repl* 'top-level-let), so <br>
say<br>
we started that repl and typed:<br>
<br>
<1> (define (f1 x) (+ x 1))<br>
f1<br>
<2> (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 "saved-repl.scm"<br>
(lambda (p)<br>
(for-each<br>
(lambda (var&val)<br>
(unless (eq? (car var&val) 'exit)<br>
(format p "(define ~S ~W)~%" (car var&val) (cdr var&val))))<br>
(*repl* '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* 'file-names) to<br>
find what files need to be loaded.<br>
<br>
</blockquote></div>