[clean-list] Advice on style, please

Richard A. O'Keefe ok@atlas.otago.ac.nz
Mon, 17 Dec 2001 14:06:01 +1300 (NZDT)


Alan Hutchison <alanh@dcs.kcl.ac.uk> wrote:
	An appeal for guidance on style:
	I want to give the class samples of code in all three styles.
	The chosen examples are
	  the "Hello World!" program
	  the echo program
	  the copy program.

A worse choice for demonstrating the utility of functional programming
would be hard to imagine.

	The problem is that the C version appears much simpler and more economical.

That's because it _is_, for this kind of application.

	Functional programming is supposed to make programming simpler.

Some kinds.

	How can this version be improved?
	
Use Haskell instead of Clean.
	-- This really is a one-liner.
	main = putStr "Hello, world\n"

The other programs are also simpler in Haskell than in C.

Why not show some INTERESTING examples instead?
I have a small collection of programming contest problems solved in C
and in Haskell.  Some of those might do.
Or the adaptive integration example from the "Why Functional Programming
Matters" paper.
Or transforming an XML document to XHTML.
(Could be quite tiny using HaXML; anyone converted that to Clean?)