caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alessandro Baretta <alex@baretta.com>
To: Ocaml <caml-list@inria.fr>
Subject: Re: [Caml-list] Map module
Date: Thu, 05 Jun 2003 20:24:28 +0200	[thread overview]
Message-ID: <3EDF8ADC.5050308@baretta.com> (raw)
In-Reply-To: <IIEMJEMIMDMLIIPHPOBLGECHCBAA.fsmith@mathworks.com>

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


      reply	other threads:[~2003-06-05 18:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-05 15:42 Alessandro Baretta
2003-06-05 15:53 ` Dominique Quatravaux
2003-06-05 15:58 ` james woodyatt
2003-06-05 16:25 ` Brian Hurt
2003-06-05 18:02   ` Alessandro Baretta
2003-06-05 18:13     ` jeanfrancois.monin
2003-06-05 18:15     ` Fred Smith
2003-06-05 18:24       ` Alessandro Baretta [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3EDF8ADC.5050308@baretta.com \
    --to=alex@baretta.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).