* Pattern matching over lazy values
@ 2007-08-18 14:57 Jon Harrop
0 siblings, 0 replies; only message in thread
From: Jon Harrop @ 2007-08-18 14:57 UTC (permalink / raw)
To: caml-list
Incidentally, would it not be enormously beneficial to be able to pattern
match over lazy values?
This syntax is never used:
# fun (x y) -> true;;
Syntax error: ')' expected, the highlighted '(' might be unmatched
so you can allow "lazy foo" as a pattern:
# let force (lazy n) = n;;
val force : 'a lazy_t -> 'a
and then make the pattern match force lazy values only as it comes across
them, so you can pattern match over lazy trees. I can't see any way to do
this without hacking the compiler...
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists/?e
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-08-18 15:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-18 14:57 Pattern matching over lazy values Jon Harrop
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox