Docs GODI Archive
Projects Blog Link DB

Search GODI:


More options
File doc/apps-cduce/tutorial_higherorder.html GODI Package apps-cduce
 
   tutorial_higherorder.html    Sources  

You can cut and paste the code on this page and test it on the online interpreter.

Higher-order functions

Introduction

TO BE DONE

A complex example

Rewrite in order not to introduce new type declarations

type Program = <program>[ Day* ]
type Day = <date day=String>[ Invited? Talk+ ]
type Invited = <invited>[ Title Author+ ]
type Talk = <talk>[ Title Author+ ]
type Author = <author> String
type Title = <title> String

let patch_program 
  (p :[Program], f :(Invited -> Invited) & (Talk -> Talk)):[Program] =
  xtransform p with (Invited | Talk) & x -> [ (f x) ]

let first_author ([Program] -> [Program];
                  Invited -> Invited;
                  Talk -> Talk)
| [ Program ] & p -> patch_program (p,first_author)
| <(k)>[ t a _* ] -> <(k)>[ t a ] 
This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml