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

I have one little hiccup in understanding Lisp. According to the Common Lisp standard, a form is an atom or list intended for evaluation. It seems simple enough.

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

How is this understood? Is the file ultimately processed as a single form for evaluation, is it a collection of forms? For some reason, it really confused me.

+4
source share
3 answers

According to CLHS :

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

, .

+11

- . ( OPEN WITH-OPEN-FILE) , READ , .

Common Lisp , , , , .

http://l1sp.org/cl/3.2.3 .

http://l1sp.org/cl/24.1.1 .

+6

Lisp. Common Lisp, , . .

, . EVAL , - . , EVAL. , : , .

, , . SBCL, Clojure , .

Lisp . . , . Common Lisp , OPEN, WITH-OPEN-FILE, READ, LOAD, COMPILE-FILE ..

, Lisp "". EVAL Lisp , . Lisp . : , .

Common Lisp fasl (fast load). - SBCL, . . , .

, Common Lisp : Lisp FASL .

, Lisp , , . Lisp .

​​ Lisp.

:

  • Lisp ( ) . Lisp. , Lisp , . , , , , .

  • - Interlisp-D, Lisp, Common Lisp. Interlisp-D . , .

  • Lisp . , , - ( , ), , , . , , Lisp . Lisp, . Lisp .

+3
source

Source: https://habr.com/ru/post/1531415/


All Articles