a generic update(map) function

Freeman Huang freeman2004 at gmail.com
Tue Nov 23 00:53:06 CET 2004

Hi, all,

I am new to CDuce and was wondering if I can write a generic
program to update all values of a specific type of element, just
like a general map function. for example if I want to increase
everybody's salary:

type Salary = <salary> [Int]

let increase (Int -> Int) x-> x+100

let updateSalary (Any -> Any)
  |<salary> [(x & Int)] -> <salary> [ (increase x) ]
  |<(y)> x & [_*] -> <(y)> (map x with z -> updateSalary z)
  |x -> x

When I tried this I got warning that the second case is
not used. not sure if such a program is possible with
appropriate design of cases or impossible at all?

could someone kindly shed some light on this issue?

Freeman Huang
School of Computing
Queen's University

More information about the Cduce-users mailing list