From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 6C2097EE25 for ; Tue, 19 Nov 2013 16:05:45 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of jeansaintremy@yahoo.com) identity=pra; client-ip=98.138.91.53; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jeansaintremy@yahoo.com"; x-sender="jeansaintremy@yahoo.com"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of jeansaintremy@yahoo.com) identity=mailfrom; client-ip=98.138.91.53; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jeansaintremy@yahoo.com"; x-sender="jeansaintremy@yahoo.com"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@nm3-vm1.bullet.mail.ne1.yahoo.com) identity=helo; client-ip=98.138.91.53; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jeansaintremy@yahoo.com"; x-sender="postmaster@nm3-vm1.bullet.mail.ne1.yahoo.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoEEAH59i1Jiils1eWdsb2JhbABMDYJDgU8IrFmTfhYOAQEJCwwIEiMHgiABFhwEFQECFSIBFAkBcAEOAQYYhVyCGQwBAQIPnwCHAohZCYMAhDMBIwMBIwOIYgEGCgEBAZQDA4dXgWuKboNphjg1VYhwcIQt X-IPAS-Result: AoEEAH59i1Jiils1eWdsb2JhbABMDYJDgU8IrFmTfhYOAQEJCwwIEiMHgiABFhwEFQECFSIBFAkBcAEOAQYYhVyCGQwBAQIPnwCHAohZCYMAhDMBIwMBIwOIYgEGCgEBAZQDA4dXgWuKboNphjg1VYhwcIQt X-IronPort-AV: E=Sophos;i="4.93,729,1378850400"; d="scan'208,217";a="43824820" Received: from nm3-vm1.bullet.mail.ne1.yahoo.com ([98.138.91.53]) by mail2-smtp-roc.national.inria.fr with ESMTP; 19 Nov 2013 16:05:44 +0100 Received: from [98.138.101.129] by nm3.bullet.mail.ne1.yahoo.com with NNFMP; 19 Nov 2013 15:05:42 -0000 Received: from [98.138.101.172] by tm17.bullet.mail.ne1.yahoo.com with NNFMP; 19 Nov 2013 15:05:42 -0000 Received: from [127.0.0.1] by omp1083.mail.ne1.yahoo.com with NNFMP; 19 Nov 2013 15:05:42 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 41257.42079.bm@omp1083.mail.ne1.yahoo.com Received: (qmail 80557 invoked by uid 60001); 19 Nov 2013 15:05:41 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1384873540; bh=ysirubX+3rpoF9RXGS9YeO+ACEcSY6/neWrlQCdq83I=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=GS3T7tMt+GB67KmUPp+Mu01JI+fa9f0LqN57KcT15VRlXzhW2TUpN9BFqjK53JqteJNCltlF19uvOXJFoJY+WHxmbOw1pr2qburve5Rfjt2fWMtEDnzxwwZu9GDbq3FI8fvTdvwd5Y1l3oBsm+nDRNorrAhUjwThkaguj0jox+s= DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=fFU4ULbx9AX3vtO5mONQ8o+bldpt8s6zA2Stb3EiFiGpCOZyDLJDs8mPoRS9E5JmMu64ov8P+aWZPkAwzjJtiYndOBqUJTZu5vdMNBIs3oYcow3pXZDdH8t+mk9TfSczlmGgji/Uv2bMqlr0naBPP6nVe8PX860wEUj+4pLAyYk=; X-YMail-OSG: dRF7biUVM1ldUlmPjXGT.kbp_TqH4CVSxacCksdDvcWbtuV zF84kN.TEIZdkpI0nf91kUfX20PpPiBi20yEGaLxjRDImbasJ4yNjd_VDaI9 BJk5xcQnjD7f7ajssESwMsSQk.ulFsFGnSyzC_ksA9Yk_93LUGyIdXexYR_C YUaydq3hLEFXCPDVeGx2r0HEOvUvnJv_D.LAk8yTQaqCiCaNc1PwfiIV3NKP Wt.4hHZq4zQBvegUYFodjcJ._QY5nNsjh07sWn_xkvcQmMSnqKg1Rqs6q1pD uwjECv90AEniR9a.VS_MjdJuiGe6kH8LDoS1Ew1l3wostZwuYducn9c6rumu qhV2GODrz1PWQwsZ0wZscDNKNnO2BA4B5DnvGvyqpMXKUgUXY9dnKcjRqpLk p_ahyvNRtI334M6nkOJf2paerKpViNs6MLjkr429Crh6hkMRE8ESSHP5gLsG scvjV8_QwaQH.htZ34A96uprOjde31NZM77vCmcs0VbKyW4GUuyRP9sLMxzn Pw7vw0TXwFhvEbLiQCKvnoFzoF27porMqQC3zpJqlc7zjTWWjM0XjgQ-- Received: from [67.84.46.185] by web160506.mail.bf1.yahoo.com via HTTP; Tue, 19 Nov 2013 07:05:38 PST X-Rocket-MIMEInfo: 002.001,SGksCgpJIGZvdW5kIGEgbWlzc2luZyAiZG9lcyBub3QgY2hhbmdlIiBzZW50ZW5jZSBmcmFnbWVudCBpbiB0aGUgdGhpcmQgc2VjdGlvbiBvbiBMaXN0cyBhbmQgUGF0dGVybnMKCgoiRWFjaDo6IGVzc2VudGlhbGx5IGFkZHMgYSBuZXcgYmxvY2sgdG8gdGhlIHByb2NlZGluZyBwaWN0dXJlLiBTdWNoIGEgYmxvY2sgY29udGFpbnMgdHdvIHRoaW5nczogYSByZWZlcmVuY2UgdG8gdGhlIGRhdGEgaW4gdGhhdCBsaXN0IGVsZW1lbnQsIGFuZCBhIHJlZmVyZW5jZSB0byB0aGUgcmVtYWluZGVyIG9mIHRoZSBsaXMBMAEBAQE- X-Mailer: YahooMailWebService/0.8.166.601 Message-ID: <1384873538.80445.YahooMailNeo@web160506.mail.bf1.yahoo.com> Date: Tue, 19 Nov 2013 07:05:38 -0800 (PST) From: Jean Saint-Remy Reply-To: Jean Saint-Remy To: "caml-list@inria.fr" MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="1803139914-1017197756-1384873538=:80445" Subject: [Caml-list] short-circuit in Real World Ocaml ch 3 deserves a comment --1803139914-1017197756-1384873538=:80445 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Hi, I found a missing "does not change" sentence fragment in the third section = on Lists and Patterns "Each:: essentially adds a new block to the proceding picture. Such a block= contains two things: a reference to the data in that list element, and a r= eference to the remainder of the list. This is why :: can extend a list wit= hout modifying it; extension allocates a new list element but {here} change= any of the existing ones, as you can see: " The example code using pattern matching appears to be a "let rec" short-cir= cuit which I believe deserves a comment in the book. It appears to be puzzl= ing, we are binding a "zero" to the head of the list in order to drop it? I= think it is a fine example of OCaml that should be encouraged, not just an= isolated case. let rec drop_zero ls =3D match ls with =A0 | [] -> []=20 =A0 | 0 :: tl -> drop_zero tl =A0 | hd :: tl -> hd :: drop_zero tl=20 ;; With kind regards, Jean --1803139914-1017197756-1384873538=:80445 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
Hi,

I found a missing "does not= change" sentence fragment in the third section on Lists and Patterns

"Each:: essentially adds = a new block to the proceding picture. Such a block contains two things: a reference to the data in= that list element, and a reference to the remainder of the list. This is why :: c= an extend a list without modifying it; extension allocates a new list el= ement but {here} change any of the existing ones, as you can see: "


The example code using pattern matching appears to be a "let rec" s= hort-circuit which I believe deserves a comment in the book. It appears to = be puzzling, we are binding a "zero" to the head of the list in order to dr= op it? I think it is a fine example of OCaml that should be encouraged, not= just an isolated case.

let rec drop_zero ls =3D m= atch ls with
  | [] -> []
  | 0 :: tl= -> drop_zero tl
  | hd :: tl -> hd :: drop_zero tl
;;

With kind regards,

<= /div>
Jean
= --1803139914-1017197756-1384873538=:80445--