Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Andrew Conway <arc@labri.u-bordeaux.fr>
To: caml-list@margaux.inria.fr
Subject: Re: [Q]: Mutable variant types in Caml Light 0.7
Date: Thu, 19 Oct 1995 16:16:10 +0100	[thread overview]
Message-ID: <9510191516.AA04207@waves> (raw)
In-Reply-To: Your message of "Thu, 19 Oct 1995 11:31:13 +0100." <9510191031.AA19481@gr6>

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



Christian Boos wrote:
> ...
>Si ce raisonnement est correct, une amélioration pourrait alors être
>effectuée, permettant de cumuler efficacité et souplesse :
>  - soit une grosse refonte de la syntaxe des types, pour avoir des
>déclarations à la SML (mais plus expressives, en raison du 'mutable') :
>	
>	type t = A of { a:int; mutable b:float; c:string; }
>
>  - soit en faisant une modification sur la syntaxe de l'extension 3.6
>permettant d'avoir des types "union" mutables :
>
>	type t = A of int * (mutable float) * string

Moi aussi!

Why I would like it? Well, although I generally like strictness, 
sometimes lazy lists are useful. So I decided to make some lazy list
routines. I used the following type:

type 't lazylist =
          EndLL 
        | Element of 't llcont
        | Unconstructed of (unit -> 't lazylist)
and 't llcont = { value : 't ; mutable next : 't lazylist}
;;

The trouble is that takes 5 words per evaluated element, whereas 
with Christian's suggestion it could be done in 3 words like 
normal lists, as well as avoiding the ugliness in the above type
definition. Neither are huge things for me, but since it has already been
suggested, I second it.

( Incidentally, is there a nicer basic structure for lazy lists? )
			
Thanks again,

			Andrew.
 




  parent reply	other threads:[~1995-10-20 12:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-10-19 10:31 Christian Boos
1995-10-19 14:53 ` Pierre Weis
1995-10-19 15:16 ` Andrew Conway [this message]
1995-10-20 18:55   ` Pierre Weis

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=9510191516.AA04207@waves \
    --to=arc@labri.u-bordeaux.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