Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Lisp, what is the relationship between a form and a file?

I'm having one little hiccup in understanding Lisp. According to the Common Lisp standard, a form is an atom or list that is meant to be evaluated. That seems easy enough.

In the real world, at the moment, we store programs in files. SBCL, Clojure, and the like all have the notion of a file that can also be evaluated.

How is this understood? Is a file treated ultimately like a single form to be evaluated, is it a collection of forms? For some reason, this has been really confusing me.

like image 462
Elf Sternberg Avatar asked Nov 30 '22 02:11

Elf Sternberg


1 Answers

According to the CLHS:

load sequentially executes each form it encounters in the file
named by filespec

which means that a file is a sequence of forms.

like image 123
uselpa Avatar answered Dec 05 '22 01:12

uselpa