From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p4SG4YiF032220 for ; Sat, 28 May 2011 18:04:34 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: An0DAJkc4U3RVdU2imdsb2JhbAA/AQMSmDGOBggUAQEBCgkNBxIGIaoSjB6CN4NUOYhiAQEDBoYYBJBPhD6BEYVXO4NV X-IronPort-AV: E=Sophos;i="4.65,286,1304287200"; d="scan'208,217";a="109758461" Received: from mail-yw0-f54.google.com ([209.85.213.54]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 28 May 2011 18:04:28 +0200 Received: by ywf7 with SMTP id 7so1637778ywf.27 for ; Sat, 28 May 2011 09:04:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type; bh=y3S7Y54iZLI6jwz9wG0MZe8hEMlTw6A2xh2sZJpbxNo=; b=x+ckbJw/EkZke6FylD0xvrpIpszU65l1y+tMA+Wu6y3ug94z9cwKtcBhxpkTTcMNFK 4oRM58Y2mOkBDPBKDK8RZJq1KtwSWTEeD8GUTDzg1vKGxEDaB65XLwkqwXKXX4LUNwfP yzr7EN0o6964TI2hP6ck11udOxJu8Ai85/QIQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; b=FjSIPIBdzYGXDCKC9U2iUQidUtVWEVchD3NXZXVWyyUfQMOj98rYTuVrhKno6grGHW +tP2rGfNNgXHvVrFOW8HDcoT1KZAv8G13RWue+cj6aixBp75WNZ+ie9v0f+zZllhNfvm w4B+bC41rJF213covliw037TBELiqyhGzxaQY= Received: by 10.101.209.2 with SMTP id l2mr2181972anq.71.1306598666659; Sat, 28 May 2011 09:04:26 -0700 (PDT) Received: from [192.168.1.65] (99-121-78-10.lightspeed.lnngmi.sbcglobal.net [99.121.78.10]) by mx.google.com with ESMTPS id 10sm2119190anw.23.2011.05.28.09.04.25 (version=SSLv3 cipher=OTHER); Sat, 28 May 2011 09:04:25 -0700 (PDT) Message-ID: <4DE11D08.1080102@gmail.com> Date: Sat, 28 May 2011 12:04:24 -0400 From: Edgar Friendly User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 MIME-Version: 1.0 To: caml-list@inria.fr References: <4DDFDC1F.5050605@inria.fr> <165028.34675.qm@web111509.mail.gq1.yahoo.com> <20110528155839.GA9002@annexia.org> In-Reply-To: <20110528155839.GA9002@annexia.org> Content-Type: multipart/alternative; boundary="------------060901050903070501020501" Subject: Re: [Caml-list] Re: Binary logarithm of a power of 2 This is a multi-part message in MIME format. --------------060901050903070501020501 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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. --------------060901050903070501020501 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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.
--------------060901050903070501020501--