[cduce-users] Transformation d'une liste

Alain.Frisch at ens.fr Alain.Frisch at ens.fr
Fri Jul 25 15:27:32 CEST 2003


On Fri, 25 Jul 2003, Serge Leblanc wrote:

> On 2003.07.25 12:32, Alain.Frisch at ens.fr wrote:
> > Btw, this function could be written more compactly (without giving the
> > three arrow types), if it is only used for toplevel Menus:
> >
> > let transform_menu (<menu>m : Menu) : Xdl =
> >  <dl>
> >   transform m with <menu_group title=t>g ->
> >   [ <dt>[ <b>t ]; map g with <menu_item title=t>s -> <dd>[ <a
> > title=t>s ] ]
>
> Thank you Alain, but the last line of your example return the following
> error :
>
> Error at line 46 (chars 7-78), file ./ldsab/test2.cd:
> This expression should have type:
> Arrow
> but it is a pair

You should put a double semi-colon between the function declaration and
the line:

  transform_menu menu

or replace this line with:

  let _ = transform_menu menu


Maybe we tried to follow OCaml syntax too closely (OCaml has the same
issue about ;;), and we should use a more "delimited" syntax (for
instance, using explicit notation to close pattern matching-like
constructions or function bodies), which would eliminate such problems.

Well, any comment or suggestion on the syntax is welcome, this is the kind
of thing which is difficult to decide without feedback from users !


-- Alain




More information about the Cduce-users mailing list