accumulator A value that is updated on every pass through a recursive loop, for instance in for/fold.
anonymous function A nameless function created by using a lambda form rather than define. See also functions.
argument A value used as input to a function or program.
arity The number of input arguments accepted by a function, or the number of values returned by a function. Most commonly seen when you try to invoke a function with the wrong number of arguments: you will get an “arity error”.
association A pair holding a key and value.
association list A list of associations. Used as a lightweight alternative to a hash table. See also data structures.
atom A value that is not a list.
bound Describes an identifier that has a binding.
boundary In the contract system, describes places where a contract can be applied. The most common contract boundaries are the module boundary (using contract-out) and the function boundary (using define/contract). See also contracts.
binding An association of a value with an identifier. A binding can be made explicitly (e.g., with define) or implicitly (e.g., a require expression adds bindings to a program). A program cannot run unless every identifier has a binding, otherwise you get the famous “unbound identifier” error. See also identifiers.
character An integer-like data type—distinct from a string—that represents a single Unicode value.
check An assertion about the behavior of the function, usually packaged as a unit test.
coloring annotation Used by DrRacket to determine the syntax coloring for a chunk of code.
column A field in a source location that represents the horizontal offset within the current line. Counts from 0.
combinator In the contract system, a special set of helper functions used to build contracts.
compile time The stage of program evaluation when required modules are imported and macros are expanded, resulting in a fully expanded program. Compile time happens before run time.
compiler A program that takes source code as input and converts it to a different, usually lower-level, form that can then be passed along to the next stage of processing.
compilation The act of using a compiler on a program.
composable See composability.
composability The idea of making functions and data structures that are small, self-contained, and generic, and combining them to produce more complex behaviors. An important software-design principle in Racket, and functional programming generally.
continuation A function that encapsulates the location of an expression and its surrounding evaluation context. See also continuations.
contract An optional run-time check on the input arguments or output values of a function. See also contracts.
contract combinator A special function that takes contracts as input and produces a new contract, including -> and listof. See also contracts.
control flow The path of evaluation within a program. For instance, ordinary S-expressions are evaluated from the inside out. Macros are evaluated from the outside in. Continuations allow control flow to jump from one point to another.
core syntactic form In a fully expanded program, a form that cannot be expressed in terms of more primitive forms. For a full list, see fully expanded programs in the Racket Reference.
datum The “literalized” version of an expression, usually created with quote or its equivalent, the ' prefix. The datum form of a single value is a single datum. The datum form of a parenthesized S-expression is a list of datums.
definition site The place where a macro is defined. As a result of hygiene, a macro retains the lexical context of its definition site, regardless of where it’s invoked. See also hygiene.
delimiter A token (or pair of tokens) used to set apart certain code from the surrounding code, so it can be parsed separately.
dictionary A class of Racket data types that represent key–value mappings (e.g., an association list or hash table) and can all be used with Racket’s generic dictionary functions (like dict-ref). See also data structures.
domain-specific language A language tailored to the needs of a particular set of problems. The opposite of a general-purpose language. See domain-specific languages for examples.
DSL See domain-specific language.
ellipsis Does two things in a macro. First, when used after a pattern variable in a syntax pattern, it greedily matches as many subsequent syntax objects as it can, and associates them with that pattern variable. Then, in a syntax template, it indicates that these matched elements should be handled the same way as the pattern variable. See also syntax patterns.
error An exception that’s raised when a problem occurs at run time. See also errors & exceptions.
evaluation The process of recursively reducing expressions to yield a result. See also evaluation.
exception A message that immediately propagates upward through the chain of calling functions. Any of these functions can catch the exception and handle it, or let it continue upward. If it reaches the top, the program stops. Exceptions are typically used to handle errors, but can also be used to create alternative forms of control flow. See also errors & exceptions.
exception handler A function that processes an exception, usually within a with-handlers expression. An exception handler might modify an exception, suppress it, or let it pass.
expander Used in a specific sense to mean the part of a Racket-implemented language responsible for providing the initial bindings for the code. It is, along with a reader, one of the two main parts of a Racket-implemented language. The term is also used in a general sense to mean the overall Racket subsystem that evaluates macros and produces a fully expanded program.
expansion The code returned by the operation of a macro. So named because the code returned is often more complex than the code that went in.
expression A program entity that can be evaluated to produce a value. Within Lisp languages, known as an S-expression. See also evaluation.
expression-based language A language, like Racket, that is built entirely from expressions, and contains no statements.
fixnum A small exact integer, where “small” depends on the platform. On a 64-bit machine, fixnums can range from -4611686018427387904 to 4611686018427387904.
form Alternative name, frequently seen in the Racket documentation, for certain macros.
format string An argument provided to format and similar string-conversion functions that indicates how the other arguments should be converted to strings.
fully expanded program The state of a Racket program at the end of compile time, after the expander has finished its work, where the program has been rewritten in terms of a vocabulary of core syntactic forms.
function A set of instructions that are not run until requested. Racket functions can take any number of positional arguments and keyword arguments, and optionally a rest argument. Functions can also return any number of values. Functions can be named (if created with define) or anonymous (if created with lambda). See also functions.
functional programming A style of programming where functions are designed to be self-contained, operating only on their input arguments (rather than relying on state) and returning a value (rather than relying on mutation).
garbage collection See garbage collector.
garbage collector The subsystem responsible for freeing blocks of memory no longer in use. The garbage collector runs automatically during a program. Frequently abbreviated as GC.
general-purpose language A language designed to make any kind of program, like Racket or Python or C. The opposite of a domain-specific language.
getter A function for retrieving a particular value from inside a larger data structure, like a structure type.
grammar A set of production rules defining the meaningful elements of a language, and how they fit together. Often used as the basis of a parser.
guard An expresssion that limits the iteration values of a loop, usually by testing the current iteration value with a predicate. See also loops.
hash table A data structure that maps keys to values. Both the keys and values can be any kind of data. See also data structures.
here string Alternative string-input syntax that makes it easier to handle multiline strings and strings with special characters like ". See here strings in the Racket Reference.
higher-order function A function that takes other functions as arguments, like apply, map, filter, compose1, or curry.
hygiene The principle that macros adopt the lexical context of their definition site (which is known in advance to the macro writer) rather than their calling site (which is not). This eliminates the risk of name collisions between identifiers introduced by the macro and identifiers at the calling site. (A problem also known as identifier capture.) One can override hygiene by using an unhygienic identifier. See also the hygiene explainer.
hygienic macro See hygiene.
identifier A name that can be bound to a value to produce a variable (for instance (define foo 42) makes a variable from the identifier foo). See also identifiers.
identifier capture See hygiene.
immutable Describes a data structure that can never be changed, like a pair. The opposite of mutable. In functional programming, the use of immutable data structures helps enforce the broader policy of avoiding mutation.
imperative programming A style of programming where functions don’t return values, but rather operate on external variables using mutation to change the state of the program. The stylistic opposite of functional programming.
indenter A function used within DrRacket to indent lines of source code.
infix notation A nonstandard way of writing function expressions in Racket, with the function name between two dots, anywhere amidst the argument list (x1 . func . x2 x3). When a function name is written like this, it’s treated as if it appeared in the first position (func x1 x2 x3) i.e., as prefix notation.
instantiation The moment when a module is loaded.
interposition points A set of special macros that wrap certain operations. See interposition points.
interpreter A program that takes source code as input and evaluates it, producing a result. In Racket, the idea is mostly interchangeable with compiler.
interned Refers to a data type like symbols whose allocation and storage is specially managed by Racket so that each unique instance of that data type only appears once in memory. This means that interned values can be compared with the fastest comparison function (eq?) which relies on pointer comparisons rather than value comparisons.
keyword argument A function argument parsed by name rather than position. A keyword is prefixed with #:. See also functions.
lambda In a general sense, an alternate name for a function, derived from Racket’s association with lambda calculus. In a specific sense, the lambda function creates an anonymous function. See also functions.
lambda calculus Invented by Alonzo Church in the 1930s, the lambda calculus is a way of studying computable functions. In the 1950s, John McCarthy adapted the notation of lambda calculus to create the Lisp programming language. Racket is a descendant of Lisp, so the influence of this notation continues.
language See programming language.
lexer A helper function for a tokenizer that matches characters from a source file to a series of rules that are similar to regular expressions.
lexical context The set of variables defined at a certain point in a program. Every syntax object is associated with a lexical context that determines the meanings of variables in the code. This lexical context travels with the syntax object, ensuring that its variables have consistent meaning. See also hygiene.
lift A tool available during macro expansion that moves the result of a macro from its original location to somewhere higher in the program, often the top level of the enclosing module. See, e.g., syntax-local-lift-expression.
line A field in a source location that represents the vertical line number from the top. Counts from 1.
list The fundamental data structure of Racket. An ordered sequence of values. See also lists.
macro A function that runs at compile time, taking certain code as input and rewriting it to produce new code. Also known as a syntax transformer. See also macros.
metalanguage A Racket language that can be chained to another to add features. It’s “meta” in the sense that it doesn’t do everything an ordinary language would. Rather, it does a few things, then passes the code along to the main language for the heavy lifting.
module The smallest organizational unit of code. All Racket code lives in a module. See also modules.
module language Racket lingo for a language that uses the default S-expression reader, such as the br or racket languages. See also Module Languages in the Racket Guide.
mutable Describes a data structure that can be changed, like a vector. The opposite of immutable.
mutation A programming technique whereby a function changes the value of a variable that’s been defined outside the boundary of the function. Discouraged in functional programming. See also side effects.
nonterminal An element of a grammar that can be decomposed into smaller pieces with a production rule. See also terminal.
notation Colloquial term for the surface syntax of a programming language.
optional argument An argument of a function that adopts a default value if not explicitly provided.
package The basic unit of software distribution.
pair A data structure that stores two values. More complex structures, like lists, are built from pairs. See also pairs.
parameter A special kind of function that approximates a global variable. See parameters.
parse tree The output from a parser, which consumes source code, destructures it according to a grammar, and produces this hierarchical representation of code elements.
parser A function that takes a stream of tokens and matches them to a grammar to produce a parse tree.
parser generator A program that builds a parser from a grammar. Programs written in the brag language are parser generators.
parsing The process of turning a series of tokens from a source file into a structured, hierarchical parse tree, usually by using a grammar as a guide.
path The location of a file on disk. See also paths.
pattern variable A named matcher within a syntax pattern or other pattern. See also syntax patterns.
phase A discrete stage in compilation. See also phase 0 and phase 1. See also evaluation.
phase 0 Another name for run time in Racket.
phase 1 Another name for compile time in Racket.
pointer comparison To compare two values by their location in memory, rather than their literal values. Typically only possible with interned values.
port A generic interface for reading from, or writing to, a data source (like a string, device, or disk). Ports can be used incrementally—that is, you can read or write data a little at a time, rather than all at once. See ports in the Racket Reference.
position A field in a source location that represents the number of characters away from the start. Counts from 1.
positional argument An argument of a function that is parsed according to its location in the list of input arguments. Compare keyword arguments, which are not.
prefix notation The standard way of writing function expressions in Racket, with the function name at the front, and the arguments following. Compare infix notation.
preprocessor A domain-specific language used to layer extra functionality atop existing languages, such as the C preprocessor, which doesn’t look anything like C.
procedure Alternate name for a function.
production rule Within a grammar, defines a pattern showing how a nonterminal can be decomposed into smaller pieces (consisting of terminals and other nonterminals).
predicate A function that takes any value and returns a Boolean. Generally used to test if a variable belongs to a certain class of items, like string? or list?. Commonly used with filter and contracts. By convention, names of predicates usually end with ?.
programming language A notational system mutually intelligible to humans and computers. A programming language has two key ingredients: syntax and semantics. Within Racket, a programming language is implemented as a source-to-source compiler with two parts: a reader and an expander.
quasiquote Notation for making a list that allows inner expressions to be selectively evaluated, and then either inserted or spliced into the surrounding list. See lists.
quasisyntax Similar to quasiquote, but the result of each operation is a syntax object. See also quasisyntax.
reader One of the two main parts of a Racket-implemented language. The reader is responsible for converting source code into S-expressions. It runs before the other main part of a language, the expander.
recursion When speaking of functions, recursion is the idea of designing a function so that it completes its task by calling itself. When speaking of data structures, recursion denotes a structure which can be nested indefinitely, for instance an S-expression. But these are two sides of the same coin, because a classic pattern of functional programming is using a recursive function to process a recursive data structure. See also recursion.
recursive See recursion.
REPL Abbreviation for read–evaluate–print loop. A command line for evaluating Racket expressions. See also REPL.
rest argument An argument that captures the “rest” of the arguments passed to a function, after the positional arguments and keyword arguments have been parsed. Used to make functions that can take any number of arguments, aka variadic functions.
run time The stage of program evaluation when the fully expanded program is reduced to a program result. Ordinary functions are called during run time. Run time happens after compile time.
S-expression The essential building block of Racket programs. An S-expression can be either a) an atomic value (like a string, number, or symbol) or b) a parenthesized list of values.
scope For every binding, the part of a program where that binding is visible.
semantics The fancy word used by computer scientists to describe the meaning assigned to certain notational syntax within a programming language. Roughly, within a Racket language, the expander implements the semantics.
sequence A data type that supports ordered retrieval of its elements. In practice, a sequence is not a distinct data type so much as an interface supported by other data types. For instance, lists, strings, and hash tables can all be used as sequences.
setter A function for changing a particular value from inside a larger data structure, like a structure type.
shadow When a binding implicitly overrides another binding that would otherwise be available. For example, all bindings outside a let expression are available within its body, but any identifiers bound at the top of the let will override them. For another example, if a binding is imported into a module with require, and the module defines a binding with the same name, then the local binding takes precedence.
shape The internal nesting structure of an S-expression or set of S-expressions.
side effect Something that happens as a result of calling a function, other than a value being returned. In functional programming, side effects are used sparingly. Mutation of variables is a kind of side effect. Output functions like printf and displayln are side effects.
source code A sequence of characters describing a program, usually within a source file.
source file A file that contains source code.
source location The position of an expression within a source file. Typically stored within a syntax object. Contains four fields: position, line, column, and span.
source-to-source compiler A compiler that converts the source code of one language into the source code of another. All Racket-implemented languages are essentially source-to-source compilers from the source language to Racket. Also called a transcompiler.
span A field in a source location that represents the number of characters that the code occupies, starting from its position. Counts from 0.
stack A data structure holding an ordered set of items that are added and removed from the same end (traditionally, these operations are known as push! and pop!). So named because it can be visualized as a vertical “stack” with the edits happening at the top. A Racket list can be used as a stack.
state A program value that’s used to hold information persistently, independent of a particular function. For instance, global variables. A discouraged technique in functional programming.
statement A program entity that doesn’t return a value, like goto in BASIC. There are no statements in Racket, only expressions.
stdin Abbrevation for “standard input”, the default input port used by a program. For a program in DrRacket, stdin defaults to the REPL.
stdout Abbrevation for “standard output”, the default output port used by a program. For a program in DrRacket, stdout defaults to the REPL.
structure type A custom data structure that has named fields and its own predicate. See structure types in data structures.
submodule A module that’s nested inside another module. Submodules can be nested to any depth. More importantly, loading a module does not automatically load its submodules, nor does loading a submodule automatically load its parent module. See submodules.
surface syntax See syntax.
symbol A stringlike data structure that is interned. When converted to a datum, identifiers become symbols. See also stringlike types.
syntactic form See form.
syntax This word is used in two ways. From a computer-science perspective, it refers to the surface notation of a programming language. Within Racket (and within this book) it is refers to S-expressions that represent chunks of program code. To distinguish the two, the first meaning is sometimes called surface syntax. Within a Racket language, the reader implements the surface syntax.
syntax colorer Function used by DrRacket to apply colors to source code.
syntax context The program context of a syntax object, which includes lexical context and position within the source code. See also syntax objects.
syntax object A datum that represents program code, packaged with other metadata, such as lexical context and source location. Syntax objects are used primarily as the input and output format for macros. See also syntax objects.
syntax pattern A way of notating the shape of a syntatic form, used in macros for decomposing syntax objects into their components and matching them to pattern variables. See also syntax patterns.
syntax property A key–value pair attached to a syntax object. The key must be a symbol; the value can be anything. See also syntax objects.
syntax template A syntax object that appears within a macro definition or with-pattern form. Unlike an ordinary syntax object, a syntax template can refer to any defined pattern variables. These references are automatically replaced with the underlying matched value. See also syntax patterns.
syntax transformer See macro.
terminal An element of a grammar that cannot be decomposed further. See also nonterminal.
thunk A lambda without arguments that wraps an expression to delay its evaluation. For instance, hash-ref optionally takes a thunk as input that will be evaluated only if the requested hash element isn’t found.
tokenizer A function that consumes a source-code character stream and reduces it to the smallest meaningful units, called tokens. In turn, these are used as input for a parser.
token The smallest unit of code handled by a parser. A token can refer to a literal string (gosub), a value (42), or a class of things (INTEGER).
transcompiler See source-to-source compiler.
Turing complete Describes a language that can be used to write every possible computer program. The lambda calculus is Turing complete, as is Racket. Many domain-specific languages are not. But whether a language is Turing complete has no bearing on whether it is, in practical terms, useful. As Alan Perlis said: “Beware of the Turing tar-pit in which everything is possible but nothing of interest is easy.”
unbound An identifier that has no binding. A common problem in Racket programs is the “unbound identifier” error, which arises when not every identifier used in the program has a binding. See also identifiers.
unhygienic Describes a macro-created identifier that’s deliberately introduced within a lexical context other than that of the macro itself (most commonly, the lexical context at the calling site). See also hygiene.
unhygienic identifier See unhygienic.
unit test A small, specific software test, often set up to run frequently & automatically during development. See also unit testing.
variable An identifier that has been assigned a binding. See also identifiers.
variadic A function of unlimited arity. See also rest argument.
vector A Racket data type that holds a sequence of values. Similar to a list, but has better performance when random access to elements is needed. See also data structures.