On 05/28/2011 11:58 AM, Richard W.M. Jones wrote:
It's long been on my OCaml wishlist (along with a 'return' statement)
to be able to use inline asm.
Inline asm might not be here, but there's two similar
implementations of 'return', one in Batteries and one in Jane Street
Core.
http://ocaml.janestreet.com/?q=node/91
http://ocaml-batteries-team.github.com/batteries-included/hdoc/BatReturn.html
Example (using BatReturn):
open Return
let find_in_array a e =
label (fun label ->
for i = 0 to Array.length a - 1 do
if Array.get a i = e then return label (Some i)
done;
None)
Sharing this in case anyone didn't know about these.
E.