it was evaluated. We must therefore arrange that such a bundle is correctly interpreted whenever it has to be applied to some argument. More precisely: a closure has an environment part which is a list whose two items are: (1) an environment (2) an identifier or list of identifiers, and a control part which consists of a list whose sole item is an AE. The value relative to E of a A-expression X is represented by the closure denoted by constructclosure((E, bvX), unitlist(bodyX)). This particular arrangement of the information in a closure has been chosen for our later convenience. We now describe a "mechanization" of evaluation in the following sense. We define a class of COs, called "states," constructed out of AEs and their values; and we define a "transition" rule whose successive application starting at a "state" that contains an environment E and an AE X (in a certain arrangement), leads eventually to a "state" that contains (in a certain position) either valEX or a closure representing valEX. (We use the phrase "result of evaluation" to cover both objects and closures. We suppose that the identifier closure designates a predicate that detects whether or not a given result of evaluation is a closure.) A state consists of a stack, which is a list, each of whose items is an intermediate result of evaluation, awaiting subsequent use; and an environment, which is a list-structure made up of name/value pairs; and a control, which is a list, each of whose items is either an AE awaiting evaluation, or a special object designated by 'ap,' distinct from all AEs; and a dump, which is a complete state, i.e. com- prising four components as listed here. We denote a state thus: (S, E, C, D). The environment-part (both of states and of closures) would be unnecessary if A-expressions containing free variables were prohibited. Also the dump would be unnecessary if all A-expressions were prohibited. Each step of evaluation is completely determined by the current state (S, E, C, D) in the following way: 1. If C is null, suppose the current dump D is (S\ E', C, D'). Then the current state is replaced by the state denoted by (hS : S', E', C, £>')• 2. If C is not null, then hC is inspected, and: (2a) If hC is an identifier X (whose value relative to E occupies the position locationEX in E), then S is replaced by locationEXE : 5 and C is replaced by tC. We describe this step as follows: "Scanning X causes locationEXE to be loaded." (2b) If hC is a A-expression X, scanning it causes the closure derived from E and X (as indicated above) to be loaded on to the stack. (2c) If hC is ap, scanning it changes £ as follows: hS is inspected and: (2cl) If hS is a closure, derived from E' and X', then: S is replaced by the nullist, E is replaced by derive(assoc(bvX', 2ndS))E', C is replaced by unitlist(bodyX'), D is replaced by (t(tS), E, tC, D). (2c2) If hS is not a closure, then scanning ap causes S to be replaced by ((1st S)(lnd S) : t(tS)). (2d) If hC is a combination X, C is replaced by randX : (ratorX : (ap : tC)). Formally this transformation of one state into another is Transform(S,E,C,D) = nullC->[hS:S',E',C,D'] where S',E',C,D' = D else-*- identifierX-+ [locationEXE:S, E, tC, D] [constructclosure((E, bvX),unitlist(bodyX)) :S, E, tC, D] X = ap-> closure(hS) -> [(), derive{assoc(J,2ndS)E'), C, (t(tS), E, tC, D)] where E',J = environmentparl(hS) and C" = controlpart(hS) else->[(lstS)(2nd):t(tS), E, tC, D] else-*- [S, E, randX:(ratorX:(ap:tC)), D] where X — hC We assume here that an AE composed of a single identifier is the same object as the identifier itself. This suggests a more general assumption that whenever one of the alternative formats of a structure definition has just one component, the corresponding selector and constructor are both merely the identity function. We also assume that a state is identical to a list of its four components. This suggests a more general assumption that whenever a structure definition allows just one format, the constructor is the identity function. Without these assumptions the above definition would be a bit more 317 Downloaded from https://academic.oup.com/comjnl/article/6/4/308/375725 by guest on 01 October 2021 Mechanical evaluation the A-expression and the environment relative to which it was evaluated. We must therefore arrange that such a bundle is correctly interpreted whenever it has to be applied to some argument. More precisely: a closure has an environment part which is a list whose two items are: (1) an environment (2) an identifier or list of identifiers, and a control part which consists of a list whose sole item is an AE. The value relative to E of a A-expression X is represented by the closure denoted by constructclosure((E, bvX), unitlist(bodyX)). This particular arrangement of the information in a closure has been chosen for our later convenience. We now describe a "mechanization" of evaluation in the following sense. We define a class of COs, called "states," constructed out of AEs and their values; and we define a "transition" rule whose successive application starting at a "state" that contains an environment E and an AE X (in a certain arrangement), leads eventually to a "state" that contains (in a certain position) either valEX or a closure representing valEX. (We use the phrase "result of evaluation" to cover both objects and closures. We suppose that the identifier closure designates a predicate that detects whether or not a given result of evaluation is a closure.) A state consists of a stack, which is a list, each of whose items is an intermediate result of evaluation, awaiting subsequent use; and an environment, which is a list-structure made up of name/value pairs; and a control, which is a list, each of whose items is either an AE awaiting evaluation, or a special object designated by 'ap,' distinct from all AEs; and a dump, which is a complete state, i.e. com- prising four components as listed here. We denote a state thus: (S, E, C, D). The environment-part (both of states and of closures) would be unnecessary if A-expressions containing free variables were prohibited. Also the dump would be unnecessary if all A-expressions were prohibited. Each step of evaluation is completely determined by the current state (S, E, C, D) in the following way: 1. If C is null, suppose the current dump D is (S\ E', C, D'). Then the current state is replaced by the state denoted by (hS : S', E', C, £>')• 2. If C is not null, then hC is inspected, and: (2a) If hC is an identifier X (whose value relative to E occupies the position locationEX in E), then S is replaced by locationEXE : 5 and C is replaced by tC. We describe this step as follows: "Scanning X causes locationEXE to be loaded." (2b) If hC is a A-expression X, scanning it causes the closure derived from E and X (as indicated above) to be loaded on to the stack. (2c) If hC is ap, scanning it changes £ as follows: hS is inspected and: (2cl) If hS is a closure, derived from E' and X', then: S is replaced by the nullist, E is replaced by derive(assoc(bvX', 2ndS))E', C is replaced by unitlist(bodyX'), D is replaced by (t(tS), E, tC, D). (2c2) If hS is not a closure, then scanning ap causes S to be replaced by ((1st S)(lnd S) : t(tS)). (2d) If hC is a combination X, C is replaced by randX : (ratorX : (ap : tC)). Formally this transformation of one state into another is Transform(S,E,C,D) = nullC->[hS:S',E',C,D'] where S',E',C,D' = D else-*- identifierX-+ [locationEXE:S, E, tC, D] [constructclosure((E, bvX),unitlist(bodyX)) :S, E, tC, D] X = ap-> closure(hS) -> [(), derive{assoc(J,2ndS)E'), C, (t(tS), E, tC, D)] where E',J = environmentparl(hS) and C" = controlpart(hS) else->[(lstS)(2nd):t(tS), E, tC, D] else-*- [S, E, randX:(ratorX:(ap:tC)), D] where X — hC We assume here that an AE composed of a single identifier is the same object as the identifier itself. This suggests a more general assumption that whenever one of the alternative formats of a structure definition has just one component, the corresponding selector and constructor are both merely the identity function. We also assume that a state is identical to a list of its four components. This suggests a more general assumption that whenever a structure definition allows just one format, the constructor is the identity function. Without these assumptions the above definition would be a bit more 317 Downloaded from https://academic.oup.com/comjnl/article/6/4/308/375725 by guest on 01 October 2021 ng valEX. (We use the o cover both objects and t the identifier closure etects whether or not a closure.) which is a list, each of n intermediate result of g subsequent use; hich is a list-structure made airs; a list, each of whose items waiting evaluation, or a ignated by 'ap,' distinct complete state, i.e. com- nents as listed here. D). of states and of closures) xpressions containing free Also the dump would be s were prohibited. completely determined by (2d) If hC is a combination X, C is replaced by randX : (ratorX : (ap : tC)). Formally this transformation of one state into another is Transform(S,E,C,D) = nullC->[hS:S',E',C,D'] where S',E',C,D' = D else-*- identifierX-+ [locationEXE:S, E, tC, D] [constructclosure((E, bvX),unitlist(bodyX)) :S, E, tC, D] X = ap-> closure(hS) -> [(), derive{assoc(J,2ndS)E'), C, (t(tS), E, tC, D)] where E',J = environmentparl(hS) and C" = controlpart(hS) else->[(lstS)(2nd):t(tS), E, tC, D] else-*- [S, E, randX:(ratorX:(ap:tC)), D] where X — hC We assume here that an AE composed of a single identifier is the same object as the identifier itself. This suggests a more general assumption that whenever one m/comjnl/article/6/4/308/375725 by guest on 01 October 2021