caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Luc Maranget <luc.maranget@inria.fr>
To: FernandezPons@iFrance.com (Diego Olivier Fernandez Pons)
Cc: fabrice.le_fessant@inria.fr, caml-list@inria.fr (Caml)
Subject: Re: [Caml-list] If ou Pattern-matching ?
Date: Wed, 14 Nov 2001 12:35:08 +0100 (MET)	[thread overview]
Message-ID: <200111141135.MAA0000000658@beaune.inria.fr> (raw)
In-Reply-To: <000501c16c9f$9bfe03c0$2d2ce8d4@Utilisateur> from "Diego Olivier Fernandez Pons" at nov 14, 2001 12:57:29

Je répond en bloc à tout et brièvement.


Sans penser que nous (implémenteurs Caml etc.) détenons la science
infuse, je crois que notre avis sur comment doit être compris un trait
a un certain poids.


Donc le filtrage doit être interprété comme je l'ai expliqué
dans mon message précédent (prédicat ``<='' + liasons).
Ce n'est pas si dur à comprendre.

Le mot « sémantique » fait peut être peur, mais ça ne veut rien dire
d'autre que « voilà ce que votre programme fait ».
Une explication pas trop dure est de dire : voila comment votre
filtrage se traduit en ``if'' et en fonction d'accès aux champs

let f liste = match liste with
| [] -> 0
| x::_ -> x

C'est en fait :

let f liste =
  if liste = [] then 0
  else
    let x = car liste in
    x

Où ``car'' est une fonction spéciale qui accède au premier champ d'une
cellule de liste.

NB le fait que l'on puisse définir ``car'' à l'aide du filtrage ne
doit pas nous cacher que, dans le cadre de cette explication ``car''
est ``plus primitif'' que le filtrage.


Votre façon de considérer le filtrage est un brin trop compliquée.
Non seulement ça n'aiderait pas à concevoir le langage (mais c'est
notre problème), mais ça ne vous aide pas a programmer.

Maintenant, je reconnais un déficit d'explication sur ce qu'est le
filtrage aux utilisateurs et en particulier aux débutants.


--Luc Maranget


-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  parent reply	other threads:[~2001-11-14 11:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-08  2:33 [Caml-list] Pattern matching Diego Olivier Fernandez Pons
2001-11-09  0:26 ` Pixel
2001-11-09 10:59   ` Luc Maranget
     [not found] ` <15339.34220.198731.791811@lachesis.inria.fr>
2001-11-10  2:16   ` Diego Olivier Fernandez Pons
2001-11-12 10:29     ` Luc Maranget
2001-11-12  9:00       ` Diego Olivier Fernandez Pons
2001-11-13  8:00         ` Fabrice Le Fessant
2001-11-13 23:57           ` [Caml-list] If ou Pattern-matching ? Diego Olivier Fernandez Pons
2001-11-14 10:02             ` Fabrice Le Fessant
2001-11-14 10:47             ` Nicolas Barnier
2001-11-14  1:26               ` [Caml-list] Warnings possibles Diego Olivier Fernandez Pons
2001-11-14 18:24                 ` Luc Maranget
2001-11-14 11:35             ` Luc Maranget [this message]
2001-11-13 16:09         ` [Caml-list] Pattern matching Luc Maranget
2001-11-13 23:56           ` [Caml-list] Deux types de pattern-matching ? Diego Olivier Fernandez Pons
2001-11-14 10:19             ` [Caml-list] " Luc Maranget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200111141135.MAA0000000658@beaune.inria.fr \
    --to=luc.maranget@inria.fr \
    --cc=FernandezPons@iFrance.com \
    --cc=caml-list@inria.fr \
    --cc=fabrice.le_fessant@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).