Tuesday, April 24, 2012

How to define x++ (where x: int ref) in F#?

I currently use this function



let inc (i : int ref) =
let res = !i
i := res + 1
res


to write things like



let str = input.[inc index]


How define increment operator ++, so that I could write



let str = input.[index++]




No comments:

Post a Comment