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

Make a function return itself after doing some work

$
0
0
let log x = print_int x; log ;;log 111 222;;

I am expecting log to print 111 and return itself and then print 222 on the second call but it does not work as expected, I am getting an error message instead. Why? How to make it work as expected?

I also tried rec to no avail.

File "./hello.ml", line 3, characters 8-11:3 | log 111 222;;            ^^^Error: This expression has type int but an expression was expected of type         float

Viewing all articles
Browse latest Browse all 531

Trending Articles



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