Skip to search.
ocaml_beginners · Ocaml Beginners

Group Information

? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Messages

  Messages Help
Advanced
Request for commentary / grilling   Message List  
Reply Message #9680 of 13557 |
Re: "ocaml_beginners"::[] Request for commentary / grilling

On Mon, Apr 21, 2008 at 04:01:30PM -0400, Michael DiBernardo wrote:
> Yes, I was trying to avoid while loops / other iterative constructs,
> but I find that extremely difficult to do when dealing with I/O. Glad
> to know this is a common idiom, thanks for that.

At the end of the day, it's a programming language for getting stuff
done in, so I wouldn't be too precious about avoiding while loops.

There's a periodic discussion that happens on the lists about how to
read all lines from a file:

http://caml.inria.fr/pub/ml-archives/ocaml-beginners/2003/04/1f84bc1aa990459f9da\
2721e399dfcde.en.html

http://caml.inria.fr/pub/ml-archives/caml-list/2003/05/79e940406a290a4ae25b18228\
cd70133.en.html

http://caml.inria.fr/pub/ml-archives/caml-list/2004/04/5814f3200c451a4983ffb0111\
e7767c1.en.html

http://caml.inria.fr/pub/ml-archives/caml-list/2007/10/cb1c2bd7a37c8daf5a02672af\
2c2bf13.en.html


The answer is to use a while loop!

Rich.

--
Richard Jones
Red Hat



Mon Apr 21, 2008 10:32 pm

rwmjones
Offline Offline
Send Email Send Email

Message #9680 of 13557 |
Expand Messages Author Sort by Date

So after a (long) OCaml hiatus, I'm starting to get back into the language. Last night I took a few hours and wrote a trio of programs based on problems...
Michael DiBernardo
michael.dibe... Offline Send Email
Apr 18, 2008
7:03 pm

... <quote> * The assumption is that you have little memory to work with, but you are * allowed to write to scratch files with impunity. We thus read from...
Richard Jones
rwmjones Offline Send Email
Apr 19, 2008
5:10 pm

... OK, great, I wasn't sure. It's on my todo list to start looking at how some of these modules are actually implemented under the hood. ... Yes, I was trying...
Michael DiBernardo
michael.dibe... Offline Send Email
Apr 21, 2008
8:01 pm

... At the end of the day, it's a programming language for getting stuff done in, so I wouldn't be too precious about avoiding while loops. There's a periodic...
Richard Jones
rwmjones Offline Send Email
Apr 21, 2008
10:32 pm

... Good call. ... The evidence is overwhelming :) Thanks! The interesting thing about my tinkering recently is that I'm doing it in a place where I have...
Michael DiBernardo
michael.dibe... Offline Send Email
Apr 22, 2008
3:46 pm

... For the rotate function it's probably going to be a bit quicker to use Array.blit isn't it? (Although that takes a bit of extra space). ... As a general...
Richard Jones
rwmjones Offline Send Email
Apr 19, 2008
5:31 pm

... Almost certainly :) The idea was to do the reversal in-place. If I was doing this 'for real', I'd probably use blit. Plus, I have to admit that I think...
Michael DiBernardo
michael.dibe... Offline Send Email
Apr 21, 2008
8:07 pm

... I believe this is because Stream.empty is being thought of as a parser. Presumably this will be used in a context where you are expecting end-of-file. The...
Ashish Agarwal
ashish_a1975 Offline Send Email
Apr 21, 2008
9:16 pm

... Ah, I see now. I tend to think of streams in a much more general sense, without necessarily associating them with particular processes such as parsing or...
Michael DiBernardo
michael.dibe... Offline Send Email
Apr 22, 2008
3:44 pm
Advanced

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help