Some macros in Racket

I am confused by the terms for a long time, thinking it’s good to ask what exactly they mean:

but. syntax. B. Syntactic meaning. C. Syntax object. Ds-expression E.datum (in syntax-> datum)

  • What is the difference between an s-expression and a character?
  • What is the difference between s-expression and datum?
  • What is the difference between (syntax, syntax values, and syntax object) from an s-expression?
  • Code examples are provided for explanation.
+7
source share
1 answer

"Syntax" is a type of representation of source code in Racket that is a wrapper around an S-expression (see a recent blog post for Details). "Syntactic meaning" and "Syntactic object" are all synonyms for this and ni ancient days of mzscheme language functions that deal with the syntax used by syntax-value in a name. These days, we only use the "syntax" more often, and for the plural form, we use the "syntax".

An "S-expression" is either a primitive piece of data that can be entered into code (characters, numbers, strings, Booleans, etc.) in Racket, you can also include other types) or a list of these things, Thus An S-expression is any nested list structure of these primitive types on the border. Sometimes this also includes vectors (since they can be entered using the syntax #(...) ), but, as a rule, they are not taken into account.

Finally, β€œdatum” is a different name for an S expression, sometimes when you want to refer to a piece of data that has an input representation. You can see how R5RS introduces it: <Datum> can be any external representation of the Scheme object [...]. This notation is used to include literal constants in the circuit code.

Regarding your questions:

  • What is the difference between an s-expression and a character?

    Characters are an S-expression, an S-expression may contain characters.

  • What is the difference between s-expression and datum?

    Nothing. (Although there may be some subtle differences of intent.)

  • What is the difference between (syntax, syntax values, and syntax object) from an s-expression?

    They are software syntax used by macros in racket - they contain S-expressions, but they add information about the source location, lexical context, syntax properties and certificates. See this blog post for quick reference.

+6
source

All Articles