caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jon Harrop <jon@ffconsultancy.com>
To: caml-list@yquem.inria.fr
Subject: Pattern matching over lazy values
Date: Sat, 18 Aug 2007 15:57:31 +0100	[thread overview]
Message-ID: <200708181557.32056.jon@ffconsultancy.com> (raw)


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


                 reply	other threads:[~2007-08-18 15:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200708181557.32056.jon@ffconsultancy.com \
    --to=jon@ffconsultancy.com \
    --cc=caml-list@yquem.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).