POP-2, often referred to as POP2 was a programming language developed around 1970 from the earlier language POP-1 by Robin Popplestone and Rod Burstall at the University of Edinburgh. It drew roots from many sources: the languages LISP and ALGOL 60, and theoretical ideas from Landin.

PropertyValue
dbpprop:abstract
  • POP-2, often referred to as POP2 was a programming language developed around 1970 from the earlier language POP-1 by Robin Popplestone and Rod Burstall at the University of Edinburgh. It drew roots from many sources: the languages LISP and ALGOL 60, and theoretical ideas from Landin. It used an incremental compiler, which gave it some of the flexibility of an interpreted language, including allowing new function definitions at run time and modification of function definitions while a program was running (both of which are features of dynamic compilation), without the overhead of an interpreted language. It has been described as 'The first true functional language' at HOPL, the History of Programming Languages web site. Its syntax was Algol-like, except that assignments were backwards: instead of writing a := one wrote 3 -> a; The reason for this was that the language had explicit notion of an operand stack; thus, the previous assignment could be written as two separate statements: which evaluated the value 3 and left it on the stack, and -> a; which popped the top value off the stack and assigned it to the variable 'a'. Similarly, the function call f(x, y, z); could be written as x, y, z; f; (commas and semicolons being largely interchangeable) or even x, y, z. f; or (x, y, z). f; There were no special language constructs for creating arrays or record structures as they are commonly understood: instead, these were created with the aid of special builtin functions, e.g. newarray (for arrays that could contain any type of item) and newanyarray for creating restricted types of items. Thus, array element and record field accessors were simply special cases of a doublet function: this was a function that had another function attached as its updater, which was called on the receiving side of an assignment. Thus, if the variable a contained an array, then 3 -> a(4); was equivalent to updater(a)(3, 4); the builtin function updater returning the updater of the doublet. Of course, updater was itself a doublet and could be used to change the updater component of a doublet. Because of the stack-based paradigm, there was no need to distinguish between statements and expressions; thus, the two constructs if a > b then c -> e else d -> e close; and if a > b then c else d close -> e; were equivalent (note the use of close as endif hadn't been invented yet). Variables could hold values of any type, including functions, which were first-class objects. Thus, the following constructs function max x y; if x > y then x else y close end; and vars max; lambda x y; if x > y then x else y close end -> max; were equivalent. An interesting operation on functions was partial application, (sometimes referred to as "currying"). In partial application some number of the rightmost arguments of the function (which would be the last ones placed on the stack before the function is involved) were frozen to given values, to produce a new function of fewer arguments, which is a closure of the original function. For instance, consider a function for computing general second-degree polynomials: function poly2 x a b c; a * x * x + b * x + c end; This could be bound, for instance as vars less1squared; poly2(% 1, -2, 1 %) -> less1squared; such that the expression less1squared(3) applies the closure of poly2 with three arguments frozen, to the argument 3, returning the square of (3 - 1), which is 4. The application of the partially applied function causes the frozen values (in this case 1, -2, 1) to be added to whatever is already on the stack (in this case 3), after which the original function poly2 is invoked. It then uses the top four items on the stack, producing the same result as poly2(3, 1, -2, 1) i.e.
dbpprop:hasPhotoCollection
dbpprop:reference
rdf:type
rdfs:comment
  • POP-2, often referred to as POP2 was a programming language developed around 1970 from the earlier language POP-1 by Robin Popplestone and Rod Burstall at the University of Edinburgh. It drew roots from many sources: the languages LISP and ALGOL 60, and theoretical ideas from Landin.
rdfs:label
  • POP-2
owl:sameAs
skos:subject
foaf:page
is dbpprop:influenced of
is owl:sameAs of