From: Michel Quercia <michel.quercia@prepas.org>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Not allowed as right-hand side of 'let rec'
Date: Thu, 8 Aug 2002 14:56:30 +0200 [thread overview]
Message-ID: <20020808145630.715bf4c1.michel.quercia@prepas.org> (raw)
In-Reply-To: <Pine.A32.3.95.1020808134544.51718E-100000@ibm1.cicrp.jussieu.fr>
Le Thu, 8 Aug 2002 14:08:58 +0200 (DST)
Diego Olivier Fernandez Pons
<Diego-Olivier.FERNANDEZ-PONS@cicrp.jussieu.fr> écrivit :
> Je suis entrain de coder des Skip Lists ...
> ...
> let rec single = function x ->
> let h = Random.int max_height in
> let rec s = { next = Array.make h s ; next = x }
> in (1, s)
>
> Le compilateur répond : This kind of expression is not allowed as
> right-hand side of 'let rec'
Car s est défini en fonction de lui-même par un appel de fonction : s =
f(s) et le compilateur ne sait pas calculer automatiquement un point fixe
de f. Ceci devrait marcher :
let single = function x ->
let h = Random.int max_height in
let dummy = {next = [||]; content = x} in
let s = { next = Array.make h dummy ; content = x } in
Array.fill s.next 0 h s;
(1, s)
> note : si l'on pouvait avoir un affichage un peu plus réduit pour les
> enregistrements qui pointent sur eux-mêmes ?
Vous pouvez écrire une fonction d'impression ad-hoc et signaler au
toplevel de l'utiliser via la directive install_printer.
Cordialement,
--
Michel Quercia
23 rue de Montchapet, 21000 Dijon
http://michel.quercia.free.fr (maths)
http://pauillac.inria.fr/~quercia (informatique)
mailto:michel.quercia@prepas.org
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next prev parent reply other threads:[~2002-08-08 12:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-08 12:08 Diego Olivier Fernandez Pons
2002-08-08 12:56 ` Michel Quercia [this message]
2002-08-08 13:30 ` Alain Frisch
2002-08-09 8:48 Diego Olivier Fernandez Pons
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=20020808145630.715bf4c1.michel.quercia@prepas.org \
--to=michel.quercia@prepas.org \
--cc=caml-list@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