use list; double:num -> num; double(n) <= n*n; map double [1,2,3,4]; map (lambda x => x*x) [1,2,3,4];
use list; type string == list(char); type student == string X string; type class == list(student X num); c:class; c <= [(("Fred","Jones"),66),(("Ali","Mohamed"),76),(("Mary","Ward"),92),(("Colin","Gold"),31)]; map (lambda ((x,y),z) => x) c; map (lambda ((x,y),z) => z) c; foldr (0 ,(+)) (map (lambda ((x,y),z) => z) c); (foldr (0 ,(+)) (map (lambda ((x,y),z) => z) c))/length(c); averageClass: class -> num; averageClass k <= (foldr (0 ,(+)) (map (lambda ((x,y),z) => z) k))/length(k); averageClass c; type course == string X class; c1: course; c1 <=("CS1", c); c2: course; c2 <=("Maths", [(("Fred","Jones"),36),(("Ali","Mohamed"),56),(("Mary","Ward"),45),(("Colin","Gold"),71)]); averageCourse:course -> num; averageCourse(x,y) <= averageClass(y); averageCourse c1; type degreeprogramme == list(course); cs:degreeprogramme; cs <= [c1,c2]; cs; map averageCourse cs; map (lambda (x,y) => (x, averageCourse (x,y))) cs;
/usr/local/share/hope/lib
.
That explains the point of use list;
at the beginning of the above.