English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Re: How to cleanly encode "quasi-constants"?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-07-02 (17:14)
From: qrczak@k...
Subject: Re: How to cleanly encode "quasi-constants"?
01 Jul 2000 20:01:54 +1000, Julian Assange <proff@iq.org> pisze:

> The revised syntax is cleaner, but drops so much syntactic sugar,
> that the language becomes ugly due to its verbosity.

It introduces many []'s. Haskell uses optional layout to avoid that
many brackets and separators. In OCaml it would look similar to this:

value rec iter_row f row = do
       (fun (_, fi) -> match row_field_repr fi with
            Rpresent (Some ty) -> f ty
            Reither _ tl _     -> List.iter f tl
            _                  -> ())
    return (match (repr row.row_more).desc with
        Tvariant row -> iter_row f row
        Tvar -> do
            Misc.may (fun (_, l) -> List.iter f l) row.row_name
            return (List.iter f row.row_bound)
        _ -> assert False)

 __("<  Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
 \__/            GCS/M d- s+:-- a23 C+++$ UL++>++++$ P+++ L++>++++$ E-
  ^^                W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t
QRCZAK                5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-