From: Gabriel Kerneis <gabriel.kerneis@enst.fr>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Combinatorics in a functional way
Date: Wed, 21 Feb 2007 13:24:20 +0100 [thread overview]
Message-ID: <20070221132420.50cad549@localhost> (raw)
In-Reply-To: <cd67f63a0702210329v2357c938yd0f47fe218e3297c@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 451 bytes --]
Le Wed, 21 Feb 2007 12:29:06 +0100, "Nicolas Pouillard"
<nicolas.pouillard@gmail.com> a écrit :
> So in your case just use a function like range:
>
> let range n =
> let rec aux i l =
> if i = 0 then l else i::(aux (i-1) l)
> in List.rev ( aux n [] )
> ;;
I'd rather use the tail recursive version :
let range n =
let rec aux i l =
if i = 0 then l else aux (i-1) (i::l)
in aux n []
;;
--
Gabriel Kerneis
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2007-02-21 12:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-21 9:36 Erik de Castro Lopo
2007-02-21 10:36 ` [Caml-list] " David Baelde
2007-02-21 12:17 ` Frédéric van der Plancke
2007-02-21 11:06 ` Pietro Abate
2007-02-21 13:19 ` Jacques Carette
2007-02-21 11:29 ` Nicolas Pouillard
2007-02-21 12:24 ` Gabriel Kerneis [this message]
2007-02-21 13:46 ` Fernando Alegre
2007-02-21 14:36 ` Brian Hurt
2007-02-22 10:01 ` Erik de Castro Lopo
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=20070221132420.50cad549@localhost \
--to=gabriel.kerneis@enst.fr \
--cc=caml-list@yquem.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