Re: How can we rewrite pattern matching

Aydin Atay <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>
Hi everyone, thanks for the replies. I certainly agree that pattern matching here is the most elegant solution, but I have a reason for asking this question too.

Here's a more precise definition of my question:

I have this: 'input' is peeked from a stream, and XType is a type I defined previously. So when input matches my XType I produce myFun  using  x as an argument (which is in scope):

match input with 
                XType(a) -> myFun x

If I write this in a if-then-else 

    if ( ??? == ??? ) then myFun x
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.