[cduce-users] Transformation d'une liste

Alain.Frisch at ens.fr Alain.Frisch at ens.fr
Fri Jul 25 12:32:57 CEST 2003


> let transform_menu (Menu_item -> Xdd;
>                      Menu_group -> [ (Xdt | Xdd)+ ];
>                      Menu -> Xdl )
>    | <menu_item title=t>s -> <dd>[ <a title=t>s ]
>    | <menu_group title=t>g -> [ <dt>[ <b>t ] !(map g with i ->
> transform_menu i) ]
>    | <menu>m -> <dl>(map m with g -> transform_menu g)
>    ;;

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 ] ]


-- Alain




More information about the Cduce-users mailing list