Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does OCaml have syntax like Haskell's ++?

I know OCaml has List.append, but does it have an operator like Haskell's ++?

like image 535
mcandre Avatar asked May 09 '26 21:05

mcandre


1 Answers

For lists:

# (@);;
- : 'a list -> 'a list -> 'a list = <fun>
# [1;2;3] @ [4;5;6];;
- : int list = [1; 2; 3; 4; 5; 6]

For strings:

# (^);;
- : string -> string -> string = <fun>
# "abc" ^ "def";;
- : string = "abcdef"
like image 54
Matthias Benkard Avatar answered May 11 '26 11:05

Matthias Benkard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!