David Wingate <[email protected]> writes: > Hello, all. I've recently ported my scheme application to Ikarus > (love it!) and have a question. > > I'm interested in serializing a complex structure which consists of > all sorts of functions, lists, strings and numbers. I've defined > serialize and deserialize using the same code found in scheme/tests/ > fasl.ss. > > When I attempt to serialize my structure, it gives the following > error: > >> (serialize foodata) > Unhandled exception > Condition components: > 1. &assertion > 2. &who: fasl-write > 3. &message: "Cannot write a non-thunk procedure; the one given has > free vars" > 4. &irritants: (2) > > I imagine this is NOT an error in Ikarus, but rather an error in my > thinking. > > Could someone help me understand what generates this sort of error? > For example, the FASL system is quite happy to serialize the > following: > >> (serialize (lambda(x) x)) > > which also appears to have "free vars." So I'm not sure what that > means, or how to best fix it. > No, this has no free vars, as 'x' is bound in the expression '(lambda (x) x)' (as there is a formal parameter, which it refers to). This example is hence entirely independent of its environment; the following is not:
(let ((foo 42)) (serialize (lambda (x) (+ x foo)))) In the expression '(lambda (x) (+ x foo))', 'x' occurs bound, and 'foo' occurs free. See also http://en.wikipedia.org/wiki/Bound_variable. > P.S. What does FASL stand for, anyway? :) > I think it's "FASt Load" or something alike. Kind regards, Rotty -- Andreas Rottmann | ro...@icq | 118634...@icq | [email protected] http://rotty.uttx.net | GnuPG Key: http://rotty.uttx.net/gpg.asc Fingerprint | C38A 39C5 16D7 B69F 33A3 6993 22C8 27F7 35A9 92E7 v2sw7MYChw5pr5OFma7u7Lw2m5g/l7Di6e6t5BSb7en6g3/5HZa2Xs6MSr1/2p7 hackerkey.com Always be wary of the Software Engineer who carries a screwdriver. -- Robert Paul
