caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* RE: [Caml-list] really HO Functions
@ 2004-09-30 17:30 Harrison, John R
  2004-10-04 11:13 ` [Caml-list] Wierd behavior of file reading when tried to start an executable in Ocaml code Andy Yang
  0 siblings, 1 reply; 4+ messages in thread
From: Harrison, John R @ 2004-09-30 17:30 UTC (permalink / raw)
  To: caml-list; +Cc: Harrison, John R

| I've just had a look through some real programs that I've written and
the 
| answer is definitely yes. I use them quite a lot. For >2 they are
mainly 3, 
| sometimes 4 and I haven't seen any >4.

I haven't actually checked, but I suspect I'd find something similar.
There may
be an interesting psychological observation to be made here: most people
find
very high-order functions intellectually unmanageable.

Something similar is usually acknowledged in logic with respect to long
quantifier alternations (for all x there exists a y such that for all z,
...).
I believe I once saw a provocative claim by Kreisel that most
mathematical
concepts are in fact only invented in order to hide complicated
quantifier
alternations.

John.

-----Original Message-----
From: owner-caml-list@pauillac.inria.fr
[mailto:owner-caml-list@pauillac.inria.fr] On Behalf Of Jon Harrop
Sent: Wednesday, September 29, 2004 3:31 PM
To: caml-list
Subject: Re: [Caml-list] really HO Functions


On Wednesday 29 September 2004 19:48, Radu Grigore wrote:
> My question is: are there functions of level >= 2 used in practice
> (e.g. (('a -> 'b -> 'a) -> 'a -> 'b list -> 'a) -> 'c)?

I've just had a look through some real programs that I've written and
the 
answer is definitely yes. I use them quite a lot. For >2 they are mainly
3, 
sometimes 4 and I haven't seen any >4.

> If so, are 
> there any typical ones that appear in many applications (maybe not as
> widespread like map & company but at least of comparable usefulness)?

I seem to use them when I write generic functions which are later
specialised.

> One example of a level 2 function (stolen from a recent post by Jon
> Harrop) is this:
>   let sum fold = fold (+);;

Funny to think that this function is still state-of-the-art Java and
C++. ;-)

Cheers,
Jon.

-------------------
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

-------------------
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Caml-list] Wierd behavior of file reading when tried to start an executable in Ocaml code
  2004-09-30 17:30 [Caml-list] really HO Functions Harrison, John R
@ 2004-10-04 11:13 ` Andy Yang
  2004-10-04 11:28   ` Keith Wansbrough
  2004-10-04 12:40   ` skaller
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Yang @ 2004-10-04 11:13 UTC (permalink / raw)
  To: caml-list

Hi, 

I am trying to call some outside exectuables in Ocaml
code. So I tried Unix.system and Unix.exec. However I
found that the program cannot execute correctly if it
is called from Ocaml code, and at the same time it can
work smoothly if I run it directly from a console.
This program is a very simple console program, with
two files as its input. When I look into the code and
put some debugging code to print internal information
out, I found that when I start the program from Ocaml
code, the last several lines of the input file are
ignored.  I added several extrae line at the end of
the file and tried again. The lines I added are still
ignored. The file is a simple text file, the final
line looks like this: 'CONF: 721 == 45 119 124'. It is
rather simple, right? I found that when I tried to
start the program inside Ocaml, the program will
ignore the last line. It is rather wierd and
frustrating. Any suggestions and insights are welcome.


Thanks.

Andy


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-------------------
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Wierd behavior of file reading when tried to  start an executable in Ocaml code
  2004-10-04 11:13 ` [Caml-list] Wierd behavior of file reading when tried to start an executable in Ocaml code Andy Yang
@ 2004-10-04 11:28   ` Keith Wansbrough
  2004-10-04 12:40   ` skaller
  1 sibling, 0 replies; 4+ messages in thread
From: Keith Wansbrough @ 2004-10-04 11:28 UTC (permalink / raw)
  To: Andy Yang; +Cc: caml-list

> Hi, 
> 
> I am trying to call some outside exectuables in Ocaml
> code. So I tried Unix.system and Unix.exec. However I
> found that the program cannot execute correctly if it
> is called from Ocaml code, and at the same time it can
> work smoothly if I run it directly from a console.

Please post your OCaml code, and also the code of your "simple console program".

--KW 8-)
-- 
Keith Wansbrough <kw217@cl.cam.ac.uk>
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.

-------------------
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Wierd behavior of file reading when tried to start an executable in Ocaml code
  2004-10-04 11:13 ` [Caml-list] Wierd behavior of file reading when tried to start an executable in Ocaml code Andy Yang
  2004-10-04 11:28   ` Keith Wansbrough
@ 2004-10-04 12:40   ` skaller
  1 sibling, 0 replies; 4+ messages in thread
From: skaller @ 2004-10-04 12:40 UTC (permalink / raw)
  To: Andy Yang; +Cc: caml-list

On Mon, 2004-10-04 at 21:13, Andy Yang wrote:

>  found that when I start the program from Ocaml
> code, the last several lines of the input file are
> ignored. 

This sounds like a buffering problem. The trailing
lines you are trying to read in the 'executable'
have not been written to disk yet. 

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-10-04 12:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-30 17:30 [Caml-list] really HO Functions Harrison, John R
2004-10-04 11:13 ` [Caml-list] Wierd behavior of file reading when tried to start an executable in Ocaml code Andy Yang
2004-10-04 11:28   ` Keith Wansbrough
2004-10-04 12:40   ` skaller

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).