Help!

Martin J. Logan mlogan@REDACTED
Wed Aug 13 22:48:18 CEST 2003


Perhaps I have mistaken your post but it seems to me that you simply
want to iterate over a list???

On Wed, 2003-08-13 at 08:24, Jilani Khaldi wrote:
> 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