Accueil
[ Académ | Traduc | Emacs | Prgm | LaTeX | Vrac | Bib ]



Programmation (et langages)

Some parts of me like mathematics, and some parts of me like emacs hacking.
Donald Knuth.

Je m’intéresse aux langages de programmation en général, et en particulier à l’approche fonctionnelle. Je m’intéresse plus spécialement ces derniers temps aux langages permettant la programmation concurrente.

Evolution of an OCaml programmer

Quelques façons de calculer la factorielle, depuis la bonne vieille boucle pour jusqu’au lambda-calcul, en passant par la récursivité terminale, les entiers de Peano, la récursion structurelle, les foncteurs, les continuations, le style trampoline et quelques autres ...

Empilements de cercles

Un programme OCaml, rédigé en style litterate programming, permettant de dessiner de beaux empilements de cercles [pdf] [tgz].

Aussi une version en PostScript.

PostScript

Le langage PostScript, bien connu comme langage de description de page (ie format de fichier imprimable), est en fait un langage de programmation à part entière. Il est décrit entre autre dans une série de trois livres édités par Adobe, les livres

que l’on peut tous trois trouver en format pdf (!) sur le web. Ces livres sont à mon humble avis des modèles du genre. Très faciles et agréables à lire (dans l’ordre donné), extrêmement clairs, en bref d’une qualité exemplaire qu’on aimerait rencontrer plus souvent dans les livres d’informatique...

Implémentation de “FP”

J’ai réalisé (alors que je débutais en OCaml...il faudrait probablement que je reprenne ce programme) une implémentation en Objective Caml du système “FP” décrit par John Backus dans [8]. FP est un langage fonctionel sans variables muettes. Voici par exemple quelques façons de programmer la fonction factorielle :

# quelques définitions
Def eq0 = eq o [ id, ~0 ]
Def sub1 =  - o [ id, ~1 ]
Def iota = 2s o while (not o eq0 o 1s) [ sub1 o 1s, apndl ] o [ id, ~<> ]

# version récursive
Def fact = eq0 -> ~1 ;  * o [ id, fact o sub1 ]

# version itérative (ou récursive terminale)
Def ifact2 = eq0 o 1s -> 2s; fact2 o [ sub1 o 1s , * ]
Def ifact = ifact2 o [ id , ~1 ]

# version non répétitive
Def cfact = /* o iota

The Joys of the Craft

Un texte extrait de [9] décrivant de façon assez convaincante en quoi la programmation est une activité plaisante :

Why is programming fun? What delights may its practionner expect as his reward?

First is the sheer joy of making things. As the child delights in his mud pie, so the adult enjoys building things, especially things of his own design. I think this delight must be an image of God’s delight in making things, a delight shown in the distinctness and newness of each leaf and each snowflake.

Second is the pleasure of making things that are useful to other people. Deep within, we want others to use our work and to find it helpful. In this respect the programming system is not essentially different from the child’s first clay pencil holder “for Daddy’s office”.

Third is the fascination of fashioning complex puzzle-like objects of interlocking moving parts and watching them work in subbtle cycles, playing out the consequences of principles built in from the beginning. The programmed computer has all the fascination of the pinball machine of the jukebox mechanism, carried to the ultimate.

Fourth is the joy of always learning, which springs from the nonrepeating nature of the task. In one way or another the problem is ever new, and its solver learns something: sometimes practical, sometimes theoretical, and sometimes both.

Finally, there is the delight of working in such a tractable medium. The programmer, like the poet, works only slightly removed from pure thought-stuff. He builds his castles in the air, from air, creating by exertion of the imagination. Few media of creation are so flexible, so easy to polish and rework, so readily capable of realizing grand conceptual structures. (As we shall see later, this very tractability has its own problems.)

Yet the programm construct, unlike the poet’s words, is real in the sense that it moves and works, producing visible outputs separate from the construct itself. It prints results, draws pictures, produces sounds, moves arms. The magic of myth and legend has come true in our time. One types the correct incantation on a keyboard, and a display screen comes to life, showing things that never were nor could be.

Programming then is fun because it gratifies creative longings built deep within us and delights sensibilities we have in common with all men.

Quelques documents

Une interview de Robin Milner (à l’origine, entre autres, du langage de programmation ML).

En attendant qu’un peu plus de matériel soit disponible ici, voici tout de même une liste de documents accessibles en ligne sur le sujet.

[10, 11] [12, 13, 14, 15] [16]

[17, 18] [19]


http://christophe.deleuze.free.fr/  –  Page générée le 14 mars 2013