Help!

Jilani Khaldi jilani.khaldi@REDACTED
Wed Aug 13 15:24:36 CEST 2003


Hi All,
I am trying in vain to write a function that once I inserted the number of 
a chapter of a book it gives me as result its title.
For example: f(2) -> Chapitre 2

I tried many ways but can reach the correct result.

-module(chapter).
-export([f/1]).
f(X) ->
{_,_,_,Y} = {book, preface, contents,{chapters,[{chapter, 1, 'Chapitre 1'}, 
{chapter, 2, 'Chapitre 2'}, {chapter, 3, 'Chapitre 3'}]}},
{Z,Chapters} = Y...
Y now has the list of chapters, but... Surely there are many ways to get 
the result, but I couldn't find any even if it seems so simple.

Thanks!

jilani




More information about the erlang-questions mailing list