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 q32EVxQN009835 for ; Mon, 2 Apr 2012 16:31:59 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjIBAAK4eU/RVaC2imdsb2JhbABDuRUIIgEBAQoJDQcSBiOCIgIkCAEbHAIDEhAWFhgDAgECARERAQUBIg0IAQEeh2eeU4JdCowWgnGEbT+BDgEFC5ERBJVhjlA9hCU X-IronPort-AV: E=Sophos;i="4.75,357,1330902000"; d="scan'208";a="152328733" Received: from mail-gy0-f182.google.com ([209.85.160.182]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 02 Apr 2012 16:31:55 +0200 Received: by ghrr20 with SMTP id r20so1777591ghr.27 for ; Mon, 02 Apr 2012 07:31:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=wUl5D7k0oLa1PRP8ysVI9QhRt6LuC3hsbxSoWMALBZA=; b=sYH4eqppAgUConbcz0ru+RtGmXUiCFabodpRwmE1P8Cbu7dO1SGI8oNFCGA41Wxg+K t4ZgBp+0cyyCUUIJrJSgl8Cn5mJW4U8YvFUzaxk879s7ePbnPJQu0zNUyo5YFdjDPNEu vxIpxGxI8ABQCSpdyHSlDhI5r5YNJekYIjqY5mlf5Gr1uiQJtnj2KUoJrNwcGAVlpzW/ xNXxh047tWjMACOpQTNOYQ/GxDi1jNC4xCMBniNEmammEL3hpOZq9aP5OaSOae4cwEXo FaPYbmcyFWTPfh0jqWpzGbSdMU/rFQowYj/Cs56KbRHgwa+cuY0aEE+4+W9rTNI57DLX p8ng== Received: by 10.236.77.163 with SMTP id d23mr6530728yhe.100.1333377114074; Mon, 02 Apr 2012 07:31:54 -0700 (PDT) Received: from vpl727.wireless-pennnet.upenn.edu (vpl727.wireless-pennnet.upenn.edu. [130.91.142.216]) by mx.google.com with ESMTPS id c4sm41024381yhm.18.2012.04.02.07.31.53 (version=SSLv3 cipher=OTHER); Mon, 02 Apr 2012 07:31:53 -0700 (PDT) Message-ID: <4F79B858.2090502@gmail.com> Date: Mon, 02 Apr 2012 10:31:52 -0400 From: Hongbo Zhang User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: Caml List Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Caml-list] How could I implement an efficient ring buffer? Hi List, I want to implement sliding window algorithm (in place, no memory copy), I wonder whether I need to write c code. To make it clear and simple, In c, you can record the head pointer of the array, and do the modulo operations when get and set In ocaml, it seems you have an array a of type int array, you can not do things like this *(&a+5). Many thanks