caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Shortest hanging
@ 2005-09-08  3:50 Jon Harrop
  2005-09-08  9:53 ` [Caml-list] " Ville-Pertti Keinonen
  0 siblings, 1 reply; 2+ messages in thread
From: Jon Harrop @ 2005-09-08  3:50 UTC (permalink / raw)
  To: caml-list


Whilst trying to find the shortest OCaml program that hangs, I came up with:

  let rec f() = f() in f();;

and:

  let rec x = 1::x in x=x;;

Curiously, you can interrupt the former with C-C but not the latter when run 
in the top level?! I guess the latter is stuck in polymorphic equality within 
the run time system, where it doesn't check for interruption, whereas the 
former cycles around inside the bytecode interpreter. But how come the signal 
isn't raised inside compare_val?

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com


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

* Re: [Caml-list] Shortest hanging
  2005-09-08  3:50 Shortest hanging Jon Harrop
@ 2005-09-08  9:53 ` Ville-Pertti Keinonen
  0 siblings, 0 replies; 2+ messages in thread
From: Ville-Pertti Keinonen @ 2005-09-08  9:53 UTC (permalink / raw)
  To: Jon Harrop; +Cc: caml-list

On Thu, 2005-09-08 at 04:50 +0100, Jon Harrop wrote:
> Whilst trying to find the shortest OCaml program that hangs, I came up with:
> 
>   let rec f() = f() in f();;
> 
> and:
> 
>   let rec x = 1::x in x=x;;

Are you counting characters or tokens?  The following is shorter either
way:

    while true do () done;;

With -rectypes you can also do:

    let f f = f f in f f;;

Which is shorter in characters but has more tokens.



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

end of thread, other threads:[~2005-09-08  9:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-08  3:50 Shortest hanging Jon Harrop
2005-09-08  9:53 ` [Caml-list] " Ville-Pertti Keinonen

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