Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Map module
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alessandro Baretta <alex@b...>
Subject: Re: [Caml-list] Map module
Fred Smith wrote:
> The question is: Why isn't this function tail-recursive?
> 
>>let read_cap s = Scanf.sscanf s "%2s %5[0-9]%[^\r\n]%[\r\n]"
>>let rec output_table input_ch =
>>   try
>>     let line = input_line input_ch in
>>     let prov, cap = read_cap line (fun p c _ _ -> p, c) in
>>      Printf.printf "%s\t%s\n" cap prov;
>>       output_table input_ch
>>   with
>>     | End_of_file -> print_string ""
>>     | Scanf.Scan_failure (_) -> output_table input_ch
>>
>>

I have received several answers to my tail-recursion puzzle. 
I wish to thank all who helped.


Alex

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners