What is the definition of “top-level form” in Racket

Help sections on missiles 11.9. Extension of top-level forms and evaluation and compilation 13.2 use the term "top-level form" and function descriptions (top-level top-level [nm]) and (top-level extension) in the reference manual have "top-level" as a function argument, but I don’t know how to define a “top-level form.” What is the meaning of the term “top-level form” in Racket?

+6
source share
2 answers

Now I have found the exact definition of the top-level shape as the Backus-Naur format in the Racket Reference 1.2.3.1

http://docs.racket-lang.org/reference/syntax-model.html#(part._fully-expanded )

+1
source

The intuition here is that all these functions are associated with “top-level forms”, and not with a form that depends on the lexical environment. As a semi-obvious example, eval can only work with top-level forms, so this is:

 (let ([x 10]) (eval '(* 3 x))) 

does not work. The usual use of only “forms” refers to any forms, such as macro entries, which, of course, may have such links.

+3
source

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


All Articles