pattern matching and returning new object based on pattern
        Posted  
        
            by Rune FS
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Rune FS
        
        
        
        Published on 2010-04-27T18:09:43Z
        Indexed on 
            2010/04/27
            18:13 UTC
        
        
        Read the original article
        Hit count: 379
        
F#
|patter-matching
Say I'v got some code like this
match exp with
| Addition(lhs,rhs,_) -> Addition(fix lhs,fix rhs)
| Subtraction(lhs,rhs,_) -> Subtraction(fix lhs,fix rhs)
is there any way that would allow me to do something like
match exp with
| Addition(lhs,rhs,_)
| Subtraction(lhs,rhs,_) -> X(fix lhs,fix rhs)
where X be based on the actual pattern being matched
© Stack Overflow or respective owner