Quantcast
Channel: Active questions tagged ocaml - Stack Overflow
Viewing all articles
Browse latest Browse all 527

OCaml function parameter pattern matching for strings

$
0
0

I tried to pass a string in to get a reversed string. Why can't I do this:

let rec reverse x =   match x with  | "" -> ""  | e ^ s -> (reverse s) ^ e;;

The compiler says it's a syntax error. Can't I use ^ to destructure parameters?


Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>