O'Reilly logo

Exercises in Programming Style by Cristina Videira Lopes

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2

Go Forth

image

2.1 Constraints

  • Existence of a data stack. All operations (conditionals, arithmetic, etc.) are done over data on the stack.
  • Existence of a heap for storing data that's needed for later operations. The heap data can be associated with names (i.e. variables). As said above, all operations are done over data on the stack, so any heap data that needs to be operated upon needs to be moved first to the stack and eventually back to the heap.
  • Abstraction in the form of user-defined "procedures" (i.e. names bound to a set of instructions), which may be called something else entirely.

2.2 A Program in this Style

  1 #!/usr/bin/env ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required