CSc 372 - Comparative Programming Languages
1 : Introduction
Christian Collberg
Department of Computer Science
University of Arizona
- In this class we will study three languages:
Prolog, Haskell, and Icon.
- There are several reasons why you would want to learn
a large number of languages:
- There will always be new languages used in
industry. Recently, we've gone from C to Ada
to C++ to Java and (maybe) to C#. Every
computer scientist should be ready to make
this change.
- Learning a new programming paradigm
teaches you new ways to solve problems.
- Functional programming is a way to program in a more
``mathematical'' way.
- An FP program consists of a collection of simple
functions which are combined into more complex
functions, which are combined..., etc.
- FP programs are easier to reason about mathematically
than imperative (C) or object-oriented programs.
- We are going to study Haskell,
one of the more popular modern FP languages.
- Logic programming is a way to program using
ideas from logic, such as first order predicate
calculus.
- There really is only one well-know language in this
class, Prolog, and that is what we
will study.
- Prolog allows you to solve some very complex problems
very easily.
- Icon is a string processing language developed
here at the UofA.
- Icon is really a general purpose imperative language, but it
has some very powerful ways of manipulating strings.
- Other, more modern, languages in this class are
Perl, Python,
Tcl, and Ruby.
- These languages are used more and more in real
applications, since writing a Perl program is often
much faster than writing the equivalent Java/C/C++ program.
A Preview
You Are Not Supposed to Understand This Lecture!!!
yet...
The file hello.pl
Loading and running
The file hello.gh
Loading and running
The file hello.icn
Compiling and running
The file hello.pl
Loading and running
The file hello.gh
Loading and running
- repeat "Hello World!" generates an infinite list of
strings.
- take n [...] takes the first n elements of
a list, and throws away the rest.
- unlines [...] concatenates a list of strings into one
string.
The file hello.icn
Compiling and running
Remember...
You Are Not Supposed to Understand This Lecture!!!
yet...
...but you will need to know it all for the final!
- Go to the 372 web page and browse around the information
about the different languages.
- If you own your own computer, download and install the different
compilers/interpreters.
- Try to run the examples in this lecture, on your own machine,
on lectura, or on the Windows machines in the lab.
- In this class we will study three languages: Prolog, Haskell, and Icon.
- Haskell is a functional programming languages.
- Prolog is a logic programming language.
- Icon is a string processing language.
Christian S. Collberg
2005-08-22