In applied CS, it’s common to talk about pure and impure functions instead of Turing machines.
Pure functions are, broadly speaking, equivalent to Turing machines. A pure function may only depend on its inputs (like a Turing machine) and has no outputs besides the return value (like the end state of a Turing machine’s tape).
Impure functions cover algorithms that aren’t Turing machines. For example, you might have a random number generator rand: 1 → N
that outputs different natural numbers on every invocation rand()
and is hence impure. Output functions are also impure, e.g., a function write: N → 1
that writes a number into a file can’t be a Turing machine, because Turing machines have no concept of files.
Computer programs that consist entirely of pure functions aren’t very useful, because they can’t interact with the user or reality. The typical approach to solving this is to put the core program logic inside pure functions that interact with impure parts through a limited interface. That way, you can apply CS concepts to the important parts of the program and neatly separate out the impure parts.
Edit: Changed ∅ to 1 (singleton set) in function definitions. A function can’t return ∅ and a function taking ∅ can’t be called.
I wonder when Firefox is going to add a configuration menu for keybinds.