I'm in 1st year computer science at university and I'm learning
Miranda. Why would we be learning Miranda? What does it teach us
about programming in general? How can learning Miranda help with
programming in other more common languages like c and c++?
Josh,
While I could get into a long discussion about referential
transparency, etc., at this point it would be best to refer you to
one of the truly seminal papers in the field, at:
http://www.math.chalmers.se/~rjmh/Papers/whyfp.html
Read it and think about it.
Once you've done that, by all means post back with any questions you
might have. I'm sure that will spark some interesting -- and
hopefully further enlightening -- discussion.
Cheers,
--ag
[BTW - there's a notion I've been thinking about called
`localization of complexity', but it's not yet sufficiently well
formed to discuss in such a forum as this.]
--
Artie Gold -- Austin, Texas
Oh, for the good old days of regular old SPAM.
Describing algorithms succinctly in a form that can be executed.
> What type of jobs employ functional language
> programmers?
On an industry scale, very few. Most of them are in Europe.
> I'm in 1st year computer science at university and I'm learning
> Miranda. Why would we be learning Miranda? What does it teach us
> about programming in general? How can learning Miranda help with
> programming in other more common languages like c and c++?
Some students might enter CS without knowing how to approach programs in
algorithmic terms -- not as many as in the days of classical BASIC, but
some. It is important for these students to use a language that focuses on
the logic of algorithms rather than on a sequence of actions.
M.
>What is functional languages best at?
IMHO: tasks which manipulate complicated tree structures, e.g. mapping
from trees of one form to trees of another form. Compilers are a good
example of this: they map syntax trees for the source code to syntax trees
for the target code (there's also parsing at the start, and printing of
the target code at the end, but those phases are usually pretty trivial
in comparison to what goes on in the middle).
>I'm in 1st year computer science at university and I'm learning
>Miranda. Why would we be learning Miranda? What does it teach us
>about programming in general? How can learning Miranda help with
>programming in other more common languages like c and c++?
One important reason is that functional programming languages
like Miranda are much more high-level than languages such as C, C++
or Java, so it is possible to present a lot more material in Miranda.
Students can be exposed to a wider variety of different algorithms
and problem-solving techniques when using a high-level language than
is possible when using a lower-level language. This makes it easier
for them to learn general programming skills which can then be applied
in any programming language.
Another reason is that very few first year students will have encountered
Miranda before, so it will be closer to a level playing field. With
first year computer science courses, one problem is that different
students often have vastly different amounts of experience, so it's hard
to keep the experienced students interested without leaving the inexperienced
students behind. Using a language that none of the students have encountered
before reduces this problem somewhat.
--
Fergus Henderson <f...@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
To the replies you already got I would add the following. A relatively
recent trend in C++ is the assimilation of the functional paradigm in
the form of metaprogramming and various functional libraries into
its motley crew of paradigms. For example, so called metaprogramming in
C++ using the template system is essentially functional. This sort of
functionality (no pun intended) in C++ is obviously mostly concern to
library writers, but such libraries as boost::lambda, boost::functional,
FC++ among others, make the functional paradigm available in C++. These
new developments are very hard to follow or to understand without
understanding the functional point of view underlying them.
--
Aatu Koskensilta (aatu.kos...@xortec.fi)
"Wovon man nicht sprechen kann, daruber muss man schweigen"
- Ludwig Wittgenstein, Tractatus Logico-Philosophicus
FPLs can teach you how to think about _computation_ in general. You
can learn to use functions as arguments to other functions (that's
hard in some non-functional languages and often useful). You will be
less distracted by low-level tasks (like memory management) and thus
can concentrate on developing more interesting algorithms. If you
want, you can implement your own OOP-system in your functional
language (in this sense functional programming is "more general" than
OOP) and thus understand how OOP works in more common languages (or
even invent new ways to do it).
If you understand the fundamentals you will be able to grasp new
languages more easily and are less likely to become obsolete when the
next-hot-programming-language appears.
(And if you are particularly interested in C++: After learning a FPL
understanding the STL is also easier.)
...
>>I'm in 1st year computer science at university and I'm learning
>>Miranda. Why would we be learning Miranda? What does it teach us
>>about programming in general? How can learning Miranda help with
>>programming in other more common languages like c and c++?
>
>
> FPLs can teach you how to think about _computation_ in general. You
> can learn to use functions as arguments to other functions (that's
> hard in some non-functional languages and often useful).[...]
>
> If you understand the fundamentals you will be able to grasp new
> languages more easily and are less likely to become obsolete when the
> next-hot-programming-language appears.
etc.
People are rather reluctant to answer directly about Miranda.
Perhaps you should know why, there are some objective reasons.
Without willing to criticize Miranda I have to say that its time has
largely passed. David Turner developed it in mid-eighties, and it was
a breakthrough. Nice, typed, with decent syntax, and the non-strictness
whose usage was yet to be developed. Nicely distributed: marketed
by Research Software. It got its BCS award in 1990
It *had* a nice pedagogic support, Simon Thompson wrote about it yet around
1995 ("The Craft of Functional Programming").
But today people may pose some questions. Is it OK to begin teaching
with a non-strict language?
Is Miranda type system 'good' (according to some criteria)? ML or Haskell
(or Clean) have progressed a bit, while the development of Miranda
stopped quite a time ago. Was the decision about having one 'number' type
correct?
Is it alright to make a pedagogic tool out of it, while it is a proprietary,
commercial language, while others are explicitly free, installable
everywhere (and in particular on private students' computers)? Educational
version costs from 450 pounds up, and even if special student price is as
low as 50£, it is still slighly more than zero.
===
It would be interesting to know for what reasons the teachers of 'Josh'
use Miranda. Perhaps it has some particularly interesting features I forgot
about in comparison with other languages, perhaps it is considered easier,
sincerely, I would like to know...
Jerzy Karczmarczuk
> [BTW - there's a notion I've been thinking about called `localization of
> complexity', but it's not yet sufficiently well formed to discuss in
> such a forum as this.]
Localization of complexity and localization of effect, both. "Real"
engineers, who make real physical things, get locality for free, because
the universe works that way, at least whenever classical physics is
adequate. In programming, we don't get it for free, we have to
deliberately make it so. FPLs make it easier.
- ken