From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.6 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, HTML_MESSAGE,SPF_SOFTFAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id CE0D5BC6B for ; Wed, 19 Sep 2007 19:31:26 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAACz68EaDa3PXnmdsb2JhbACCcIsiAgEBBwQGBQoY X-IronPort-AV: E=Sophos;i="4.20,274,1186351200"; d="scan'208,217";a="1047929" Received: from concorde.inria.fr ([192.93.2.39]) by mail1-smtp-roc.national.inria.fr with ESMTP; 19 Sep 2007 19:32:43 +0200 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l8JHW2Kn015210 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Wed, 19 Sep 2007 19:32:02 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAACz68EaDa3PXnmdsb2JhbACCcIsiAgEBBwQGBQoY X-IronPort-AV: E=Sophos;i="4.20,274,1186351200"; d="scan'208,217";a="1047926" Received: from mailb.microsoft.com (HELO smtp.microsoft.com) ([131.107.115.215]) by mail1-smtp-roc.national.inria.fr with ESMTP; 19 Sep 2007 19:32:41 +0200 Received: from TK5-EXHUB-C101.redmond.corp.microsoft.com (157.54.70.76) by TK5-EXGWY-E802.partners.extranet.microsoft.com (10.251.56.168) with Microsoft SMTP Server (TLS) id 8.1.177.2; Wed, 19 Sep 2007 10:32:41 -0700 Received: from tk5-exmlt-w602.wingroup.windeploy.ntdev.microsoft.com (157.54.70.14) by TK5-EXHUB-C101.redmond.corp.microsoft.com (157.54.70.76) with Microsoft SMTP Server id 8.1.177.1; Wed, 19 Sep 2007 10:32:39 -0700 Received: from WIN-MSG-21.wingroup.windeploy.ntdev.microsoft.com (157.54.62.26) by TK5-EXMLT-W602.wingroup.windeploy.ntdev.microsoft.com (157.54.70.14) with Microsoft SMTP Server id 8.1.122.1; Wed, 19 Sep 2007 10:32:35 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C7FAE3.0740F453" Subject: Syntactical Array constructor evaluating elements from right to left - Why? Date: Wed, 19 Sep 2007 10:32:18 -0700 Message-ID: <43CD2D195487A448934920501C6EDB2305BD2DEC@WIN-MSG-21.wingroup.windeploy.ntdev.microsoft.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Syntactical Array constructor evaluating elements from right to left - Why? Thread-Index: Acf64wcQrARRw1vwQbeN4eS5414Yxw== From: Jakob Lichtenberg To: X-j-chkmail-Score: MSGID : 46F15D12.000 on concorde : j-chkmail score : XXX : 5/20 1 0.000 -> 3 X-Miltered: at concorde with ID 46F15D12.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; syntactical:01 syntactical:01 printf:01 printf:01 val:01 val:01 lichtenberg:01 constructor:01 constructor:01 jakob:01 jakob:01 int:01 int:01 let:03 let:03 ------_=_NextPart_001_01C7FAE3.0740F453 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Why is the syntactical array constructor [| ... |] evaluating elements from right to left: =20 # let f i =3D (Printf.printf "%d\n" i; i);; val f : int -> int =3D =20 # Array.init 3 f;; 0 1 2 - : int array =3D [|0; 1; 2|] =20 # [| f 0 ; f 1; f 2|];; 2 1 0 - : int array =3D [|0; 1; 2|] =20 Thanks, =20 - Jakob=20 =20 ------_=_NextPart_001_01C7FAE3.0740F453 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Why is the syntactical array constructor [| ... |] = evaluating  elements from right to left:

 

# let f i =3D (Printf.printf "%d\n" i; = i);;

val f : int -> int =3D <fun>

 

# Array.init 3 f;;

0

1

2

- : int array =3D [|0; 1; 2|]

 

# [| f 0 ; f 1; f 2|];;

2

1

0

- : int array =3D [|0; 1; 2|]

 

Thanks,

 

- Jakob

 

------_=_NextPart_001_01C7FAE3.0740F453--