Functional Programming

B

benjohn

I'm interested in functional programming.

I'd really like to read a good book on it. It would have practical stuff
in it, but also cover lots of the neat ideas (through practical
examples), and perhaps areas of open research.

It would be aimed at someone who's very interested in programming, and
does it as their day job, but has not really used a functional language
professionally before.

Ideally it'd be written by Dave Thomas, and would be called "Programming
Functionally: The pragmatic programmers guide" :)

Any thoughts on this, or other ways to get in to it would be great (good
blogs, wiki, mail groups, etc).

Thanks,
Benjohn
 
M

M. Edward (Ed) Borasky

I'm interested in functional programming.

I'd really like to read a good book on it. It would have practical stuff
in it, but also cover lots of the neat ideas (through practical
examples), and perhaps areas of open research.

It would be aimed at someone who's very interested in programming, and
does it as their day job, but has not really used a functional language
professionally before.

Ideally it'd be written by Dave Thomas, and would be called "Programming
Functionally: The pragmatic programmers guide" :)

Any thoughts on this, or other ways to get in to it would be great (good
blogs, wiki, mail groups, etc).

Thanks,
Benjohn
The closest thing (and highly recommended) would be the recent Pragmatic
book "Programming Erlang". Erlang is a functional programming language,
it features built-in message-passing concurrency, *and* the book is very
well written. It wasn't *written* by Dave Thomas, but I'm sure he helped
*edit* it. Dave??
 
J

James Edward Gray II

The closest thing (and highly recommended) would be the recent
Pragmatic
book "Programming Erlang". Erlang is a functional programming
language,
it features built-in message-passing concurrency, *and* the book is
very
well written.

No offense intended, but I am working through that book right now and
I would rate it as "good, but not great" writing. The author
explains some things very well and is very knowledgeable about the
topic, but he leaves out a bit much in places.

For example, I don't feel he ever properly covers printing a message
to the screen. You can figure it out from his examples and the man
pages he references, but it would be nice not to need these steps.

That said, I do feel I learned a good deal about functional
programming from it and I am glad I read it.

James Edward Gray II
 
B

Brian Adkins

I'm interested in functional programming.

I'd really like to read a good book on it.

If you like Ruby, you may also enjoy Lisp since it influenced Ruby.
I'd recommend "Practical Common Lisp" by Peter Seibel. Or "ANSI Common
Lisp" by Paul Graham. Lastly, the classic "Structure and
Interpretation of Computer Programs" by Abelson and Sussman would be
good.

Or you can just skip the books and simply stop assigning to
variables ;)

Brian Adkins
 
B

benjohn

Thanks (everyone) for your suggestions.

*snip*
Or you can just skip the books and simply stop assigning to
variables ;)

That's very much my programming style. I wonder if it comes from the
small amount of functional programming that I studied :)

I guess what I'm intersted in is the techniques or patterns that come up
in functional programs. Program transformation seems to be something
that gets used a lot, for example... I think the ideal for me would be a
reasonably gentle intro to a language (or perhaps a few - there are
quite a lot of those kinds of tutorials on the web though), and then a
series of article like chapters that cover interesting ways of using the
language.
 
X

Xavier Noria

That's very much my programming style. I wonder if it comes from the
small amount of functional programming that I studied :)

I guess what I'm intersted in is the techniques or patterns that
come up
in functional programs. Program transformation seems to be something
that gets used a lot, for example... I think the ideal for me would
be a
reasonably gentle intro to a language (or perhaps a few - there are
quite a lot of those kinds of tutorials on the web though), and then a
series of article like chapters that cover interesting ways of
using the
language.

I had that same goal, only I already had chosen Haskell.

After reading a few online tutorials I bought "Programming in
Haskell" and I think it is an excellent book. It teaches the basics,
to the point, idiomatic Haskell and functional style. I am just
learning Haskell so I don't have enough perspective, but my
impression so far is that this book is a must-read to learn, you'll
be quickly on the right track.

-- fxn
 
R

Robert Dober

Thanks (everyone) for your suggestions.

*snip*


That's very much my programming style. I wonder if it comes from the
small amount of functional programming that I studied :)

I guess what I'm intersted in is the techniques or patterns that come up
in functional programs. Program transformation seems to be something
that gets used a lot, for example... I think the ideal for me would be a
reasonably gentle intro to a language (or perhaps a few - there are
quite a lot of those kinds of tutorials on the web though), and then a
series of article like chapters that cover interesting ways of using the
language.

Well I feel that "Programming Erlang" really is what you are looking,
for. I am not finished with it, but the "gentle introduction" seems to
fit perfectly.
I tried OCaml, Haskell first but I did not find anything like
"Programming Erlang" to walk me into the concepts...

Robert
 
S

Sharon Phillips

If you like Ruby, you may also enjoy Lisp since it influenced Ruby.
I'd recommend "Practical Common Lisp" by Peter Seibel. http://www.gigamonkeys.com/book/

Or "ANSI Common Lisp" by Paul Graham.
http://paulgraham.com/onlisptext.html?asdf

As for me, I'm still sort of trying Lisp. I'm mustn't be old enough
cause I just can't acquire a taste for emacs. I find it completely
impenetrable and the 'reward' of learning Lisp isn't sufficient for
me to endure it. Every now and then, though, I give it another shot.

Erlang though? Two thumbs up.

Cheers,
Dave
 
B

Brian Adkins

As for me, I'm still sort of trying Lisp. I'm mustn't be old enough
cause I just can't acquire a taste for emacs. I find it completely
impenetrable and the 'reward' of learning Lisp isn't sufficient for
me to endure it. Every now and then, though, I give it another shot.

Cheers,
Dave

Emacs may have some advantages for Lisp, but it's not required. I use
vim (as does Graham IIRC). Thanks for the pointers to the free books -
I should've mentioned that.
 
M

M. Edward (Ed) Borasky

Sharon said:
As for me, I'm still sort of trying Lisp. I'm mustn't be old enough
cause I just can't acquire a taste for emacs. I find it completely
impenetrable and the 'reward' of learning Lisp isn't sufficient for me
to endure it. Every now and then, though, I give it another shot.

Yeah, you're right. Lisp and Forth are great old languages, but they
were a lot more fun when they (and we) were younger. :) If I hadn't
learned Lisp 1.5 in the 1970s I probably wouldn't attempt it now.

Forth, on the other hand, is something I'd probably learn now if I
didn't already know it. It's an amazing set of concepts that look really
weird until you stare at them long enough. At some point in the process,
you go, "Oh My God -- that's *brilliant*,", at which point you are a
Forth addict. :)

I do want to sit down some day with a good Scheme and learn the
internals, though. Speaking of which, a couple of weeks ago, Amazon.ca
accidentally posted a price of $4 (CDN, IIRC) for "Lisp in Small
Pieces". A bunch of folks from some other mailing lists jumped on it,
and of course, Amazon cancelled their orders, although they felt guilty
enough to give the losers a $10 gift certificate. But I ended up getting
a copy at list price and it was well worth it.
Erlang though? Two thumbs up.

Definitely!!
 
M

M. Edward (Ed) Borasky

Robert said:
Well I feel that "Programming Erlang" really is what you are looking,
for. I am not finished with it, but the "gentle introduction" seems to
fit perfectly.
I tried OCaml, Haskell first but I did not find anything like
"Programming Erlang" to walk me into the concepts...

There is also the problem with Haskell (and OCaml, Prolog, Eiffel, etc.
for that matter) that they are very much academic constructs, rather
than languages honed by real programmers who get paid to write working
software. Erlang is very much a language for real programmers who get
paid to write working software.
 
M

M. Edward (Ed) Borasky

Brian said:
If you like Ruby, you may also enjoy Lisp since it influenced Ruby.
I'd recommend "Practical Common Lisp" by Peter Seibel. Or "ANSI Common
Lisp" by Paul Graham. Lastly, the classic "Structure and
Interpretation of Computer Programs" by Abelson and Sussman would be
good.

Or you can just skip the books and simply stop assigning to
variables ;)

The graveyards are littered with the bones of programmers who thought
they'd never have to use an imperative language again. And there are
dozens -- maybe even hundreds -- of dead functional, single-assignment,
dataflow, block-diagram, and other "nifty" little magic bullet languages.

Functional programming is harder than imperative programming. Recursion
is harder to understand than iteration. Denotational and axiomatic
semantics of programming languages are harder than operational
semantics. And so on.

Anybody here remember SISAL? ID (Irvine Dataflow)? At least Matz
remembered CLU. :) I personally think Erlang is the last best hope for
functional programming.
 
M

Martin DeMello

Forth, on the other hand, is something I'd probably learn now if I
didn't already know it. It's an amazing set of concepts that look really
weird until you stare at them long enough. At some point in the process,
you go, "Oh My God -- that's *brilliant*,", at which point you are a
Forth addict. :)

I do want to learn a concatenative at some point - any opinions as to
whether I should start with Forth or jump straight to Joy or Factor?

martin
 
M

M. Edward (Ed) Borasky

Martin said:
I do want to learn a concatenative at some point - any opinions as to
whether I should start with Forth or jump straight to Joy or Factor?

martin
I guess it depends on what you want to do with it. I only briefly looked
at Joy and haven't even heard of Factor until just now. Joy struck me as
an "academicized" Forth, which I think is a "bad" thing. Forth itself
has a current ANS standard and a working committee building a new
standard, at least two commercial vendors and dozens of open-source
implementations. People actually get paid to write Forth.

I would start with GNU Forth (gforth). It's available in most Linux
distros and should run anywhere GCC runs. It does have a GCC dependency,
which might be an issue on Macs or Solaris. I don't have either so I
can't answer that -- it runs very well on Linux and Windows.
 
J

James Edward Gray II

It does have a GCC dependency,
which might be an issue on Macs or Solaris. I don't have either so I
can't answer that -- it runs very well on Linux and Windows.

The primary compiler for Macs is gcc.

James Edward Gray II
 
R

Robert Dober

Yeah, you're right. Lisp and Forth are great old languages, but they
were a lot more fun when they (and we) were younger. :) If I hadn't
learned Lisp 1.5 in the 1970s I probably wouldn't attempt it now.

Forth, on the other hand, is something I'd probably learn now if I
didn't already know it. It's an amazing set of concepts that look really
weird until you stare at them long enough. At some point in the process,
you go, "Oh My God -- that's *brilliant*,", at which point you are a
Forth addict. :)

I do want to sit down some day with a good Scheme and learn the
internals, though. Speaking of which, a couple of weeks ago, Amazon.ca
accidentally posted a price of $4 (CDN, IIRC) for "Lisp in Small
Pieces". A bunch of folks from some other mailing lists jumped on it,
and of course, Amazon cancelled their orders, although they felt guilty
enough to give the losers a $10 gift certificate. But I ended up getting
a copy at list price and it was well worth it.


Definitely!!

I know it is OT but do you share my POV that from all that old
languages the only one that is still ahead of its time is Smalltalk?
And to come back to the issue, How old is Erlang BTW (I did not find a
historical chapter in my book)?
Cheers
Robert
 
J

Joel VanderWerf

Robert said:
I know it is OT but do you share my POV that from all that old
languages the only one that is still ahead of its time is Smalltalk?

Lisp is always ahead of its time, because it is always being reinvented.
 
M

M. Edward (Ed) Borasky

Robert said:
I know it is OT but do you share my POV that from all that old
languages the only one that is still ahead of its time is Smalltalk?
And to come back to the issue, How old is Erlang BTW (I did not find a
historical chapter in my book)?
Cheers
Robert

Well, I think the Lispniks would claim that Smalltalk is a dialect of
Lisp. :) But seriously, Smalltalk is certainly not as "old" as Fortran,
Lisp, or C. Nor is it the first "object-oriented" language -- that honor
probably belongs to Simula, a dialect of Algol.

Smalltalk represents a convergence of a number of concepts, including
"everything is an object", model-view-controller architectures, actors,
graphical user interfaces, and many others. But I don't think Smalltalk
was ever "ahead of its time."

I don't really think the concept of "ahead of its time" has any meaning
where programming languages are concerned. Programming languages are in
a very real sense living creatures -- they are born, they evolve, they
cross-breed, and sometimes die.

But I can only think of a few languages that have actually died, in the
sense that they haven't evolved into something in use today. SLIP and
the IPL family of languages, with a "target market" similar to that of
Lisp, died out. COMIT and SNOBOL, string processing languages, more or
less died out, although their successor, regular expressions, is about
as vital as anything can be.

And a fair number of Algol dialects -- JOVIAL, NELIAC, Algol 68 -- were
dead-end paths off the main Algol line, today represented by C/C++/C#
and Java. Just off the top of my head, I can't think of any others that
literally disappeared from the face of the Earth.
 
B

Bill Kelly

From: "M. Edward (Ed) Borasky said:
I guess it depends on what you want to do with it. I only briefly looked
at Joy and haven't even heard of Factor until just now. Joy struck me as
an "academicized" Forth, which I think is a "bad" thing. Forth itself
has a current ANS standard and a working committee building a new
standard, at least two commercial vendors and dozens of open-source
implementations. People actually get paid to write Forth.

Yay! I used to get paid to write Forth. :D It was my favorite
language for many years.

This looks like a pretty nice explanation of how Forth works:
http://dec.bournemouth.ac.uk/forth/forth.html

I wrote a for-fun Forth interpreter in Perl a few years back:
http://tastyspleen.net/~billk/pforth/

Just stumbled on this link--kind of interesting, Forth code to
add object oriented defining methods to Forth: (classes with
inheritance... although the numbers used to link message names
to corresponding methods seems kinda clunky...)
http://www-personal.umich.edu/~williams/archive/forth/peters/ooPocketForth.txt


I've thought on occasion it might be neat to submit a ruby quiz
sometime, where the goal is to write, in ruby, the core of a Forth
interpreter/compiler, such that the rest of the language
(provided with the quiz) can bootstrap itself.

I think it's kind of one of those potential "ah ha!" moments
when one realizes how simple a Forth interpreter/compiler loop
can actually be.


I'd probably get back into Forth if I were doing small
embedded systems programming. But Forth doesn't go out of
its way to do complex things behind the scenes to help the
programmer the way Ruby does. (Fixnum -> Bignum automatic
conversion being one example... Dynamic memory allocation
with garbage collection being another...)

Ultimately I ended up feeling that while Forth's simplicity
is one of its key strengths in a context like embedded
systems, its simplicity ends up being more of a liability
when programing large applications.

But when you need to get an interpreter, compiler,
I/O subsystem, and editor in a few Kbytes of memory--Forth
is truly amazing.


Regards,

Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top