We will conduct case studies
in these programming languages, each of which supports a programming-language paradigm:
-
Python
is a scripting language with dynamic data structures (tuples, lists, and dictionaries);
it supports all of imperative, declarative, and o-o programming.
It is great for developing small- and medium-sized programs quickly.
Systems hackers use it to write utilities and to "glue together"
applications that don't otherwise fit together. Once you learn Python, you have also "learned" Javascript, PHP, Ruby, Perl, etc.
-
* Please read
Installing Python to learn how
to check for Python on your machine, install it if needed, and
use it to develop and test software.
-
* If you have never programmed in Python before, you can relax ---
it looks like Visual Basic or Javascript or any other baby assignment
language.
Here are some samples of Python code.
(Here is a zipped folder of the samples.)
Try these with your implementation.
IMPORTANT: Python uses indentation to show the nesting of commands. You can indent using either spaces or tabs, but you cannot mix them. In my examples, I use all spaces to do indentation.
(If you mix leading tabs with leading spaces you will get strange syntax errors.)
-
*
a terse language summary and
terse notes on lists and dictionaries,
the two most important data structures in Python. Here is
a complete tutorial.
-
* PythonTutor is a great visualization tool for the Python virtual machine
-
* The language's website is at
http://www.python.org/,
where you will find a useful
library reference page.
-
* This nice on-line book,
The Python Standard Libary,
shows you how to use Python to do clever systems hacking and gluing,
the sort of stuff that is not normally taught in courses but is hugely useful in
practice.
-
-
ML
("MetaLanguage") is a functional language that cleverly
combines compile-time type checking with dynamic data structures.
This combination is important, because typed o-o languages like Java and C# aren't "dynamic enough".
Once you learn how ML type checks dynamic structures, you will be ready to learn and use the next-generation
o-o language,
Scala, which is "Java-plus-ML".
-
* A good reference to ML is the text,
Elements of ML Programming by Jeffrey Ullman (but it's way overpriced --- get a used copy if you wish to buy it).
Here are some other references, all on-line:
* You will probably need to install ML on your computer;
try one of these:
-
SML New Jersey (claims to work
on any of Windows, Mac, Linux; try this one first)
-
Moscow ML.
(supposedly a ``lighter'' version of ML; works with Windows and Linux)
-
MLton (Linux, Unix, Mac)
-
Prolog is the classic logic-programming language, where you write a "logic specification" of an algorithm, and the computer executes the specification --- there is no "coding" step!
-
* Here is a good, easy-to-install implementation:
www.swi-prolog.org.
-
* Here is some
intro material on Prolog that I wrote for my CIS301 students.
-
* This material is oriented towards using SWI Prolog:
PLPM, St. Etienne, France |
CSC485, Univ. Toronto
|