hjfghj

Doug Bagley, “Functional Programming Koans, in OCaml”, public translation into Russian from English More about this translation.

Another translations: into Ukrainian, into Japanese. Translate into another language.

Participants

evilddd1 no points
Join Translated.by to translate! If you already have a Translated.by account, please sign in.
If you do not want to register an account, you can sign in with OpenID.
Pages: ← previous Ctrl next next untranslated
1 2 3

Functional Programming Koans, in OCaml

hjfghj

History of edits (Latest: evilddd 1 year, 7 months ago) §

This page is in the spirit of having a little fun while pointing out some of the important concepts of Functional Programming. I wrote most of them, but I got a couple ideas from others, who I will certainly credit if asked. However, all blame for mistakes or inappropriateness should go to me. So without further ado ...

FP Koans (in OCaml)

Once the student has mastered the basics of FP, he is ready to study the FP Koans. The study of FP Koans will help one achieve True FP Nature. (By the way, if you do not know what a koan is Zen Buddhism, it is like a small story or statement given by a master to a student, whose subject is usually not literally about Zen, but it is such that when the student grasps the truth of it they will achieve some true understanding of Zen, perhaps even enlightenment.)

You stand before the mountain.

Learning the art of Functional Programming (FP) is like Zen. In the beginning the student of FP sees his task as a large mountain. Those who study it struggle to climb its heights. Those who know it look back and see no mountain.

The Koan of Imperative/Declarative

A student came to Xavier Leroy in his office one day, and commanded "Tell me how to achieve Knowledge of FP!", to which Xavier replied, "Do you want me to be a good teacher or a bad teacher?" The poor student replied, "I do not understand!" So Xavier replied, "Well, you could have me go to the trouble to tell you how to learn, or instead simply tell you what to learn." And the student was enlightened.

The Koan of Currying (A koan about food, that is not about food)

A student came to Jacques Garrigue and said, "I do not understand what currying is good for." Jacques replied, "Tell me your favorite meal and your favorite dessert". The puzzled student replied that he liked okonomiyaki and kanten, but while his favorite restaurant served great okonomiyaki, their kanten always gave him a stomach ache the following morning. So Jacques took the student to eat at a restaurant that served okonomiyaki every bit as good as the student's favorite, then took him across town to a shop that made excellent kanten where the student happily applied the remainder of his appetite. The student was sated, but he was not enlightened ... until the next morning when he woke up and his stomach felt fine.

Pages: ← previous Ctrl next next untranslated
1 2 3