Intro to Programming
OS and apps are software, or programs
-
a set of instructions telling the computer (hardware) what to do with some
data
The computer itself only does very basic instructions
-
move a word in memory
-
add two words
-
compare two words
-
jump to another instruction
-
set the color at some pixel on the screen
-
read a keyboard key push
If all programs were written at this level, programming would be very hard
and tedious!
-
not only that, but the basic instructions can be different from computer
to computer
So, a level of abstraction is made.
-
abstraction is a key concept in computer science, and comes up again and
again.
-
abstraction is a generalization meant to hide details and complexity
-
allows us to build complex systems (e.g., automobile)
-
allows us to relate different systems (e.g., diesel truck, car, airplane)
Define an virtual computation environment, then define a language for writing
programs in that environment.
-
must be able to somehow translate the virtual computations into real ones
-
Turing (19...) showed the equivalence of computation environments
-
Example: my kitchen as a real environment, a recipe as a virtual computation
Let's look at math as a virtual computation environment
-
what is the data? numbers.
-
we can talk about sets of numbers -- naturals, reals, integers, positives
-
what are some operations? plus, minus, times, greater-than, less-than,
log
-
is there a difference between doing and just being? what
is 4*3?
-
note that complex operations can be defined in terms of simpler ones --
multiplication
-
algebra introduces unknowns -- identifiers.
-
equality in math is a relation, not an assignment.
-
so, algebra also introduces functions.
-
functions as doing, or as being
Math, in this pure form, forms a functional computation environment.
-
all computation is in terms of relations
-
what values for the unkowns make the relations true?
-
function is a mapping from one set to another set
-
(a mathemetician is a computer using the math virtual computation environment)
Our functional programming language is ML.
A Programming Language is:
-
a language for a virtual compuation environment
-
a very formal language
-
precise syntax (structure)
-
precise semantics (meaning)
Reading Assignment: Ullman (ML), Chapter 1 and Chapter 2, section 1 (2.1)