caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: pbrisset@eis.enac.dgac.fr
To: caml-list@margaux.inria.fr
Cc: pbrisset@eis.enac.dgac.fr
Subject: Re:  affichage de liste
Date: Thu, 22 Feb 1996 12:45:36 +0100	[thread overview]
Message-ID: <199602221145.MAA28980@concorde.inria.fr> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1162 bytes --]


> let rec integer_interval n m =
>   if m < n then []
>   else n :: ( integer_interval (n+1) m);;
> 
> ou de sa version imperative
> 
> let intervalle_entier n m =
>          let accu= ref [] in
>                 for i =m downto n do
>                 accu := i :: !accu done;
>         !accu ;;
> 
> (evidemment, j'entend d'ici les remarques : la premiere version est bien
> plus claire et la deuxieme plus rapide et les reponses "c'est meme pas vrai
> et puis on est dans les annees 90" ....)
> la n'est pas la question (ceci dit si vous voulez reagir...)

Et avec le récurseur du système T de Gödel (ca fait riche,
n'est-ce-pas), c'est pas plus joli ?

#let rec recurseur z f = function 
   0 -> z
 | n -> f (n-1) (recurseur z f (n-1));;
recurseur : 'a -> (int -> 'a -> 'a) -> int -> 'a = <fun>

#let intervalle n m = recurseur [] (fun k reste -> (m-k)::reste) (m-n+1);;
intervalle : int -> int -> int list = <fun>

#intervalle 10 20;;
- : int list = [10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20]


> Luc ALBERT
> prof prepa Lycee Charlemagne

 J'ai malheureusement peur que les élèves ne soient pas très sensibles
à cette esthétique...

--Pascal Brisset





             reply	other threads:[~1996-02-22 12:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-02-22 11:45 pbrisset [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-02-21 22:31 Luc ALBERT
1996-02-22 10:37 ` Pierre Weis
1996-02-22 11:22 ` Michel Mauny

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=199602221145.MAA28980@concorde.inria.fr \
    --to=pbrisset@eis.enac.dgac.fr \
    --cc=caml-list@margaux.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).