---------------------------------------------------------------------- > module Replace ( replace > ) > where ----------------------------------------------------------------------
---------------------------------------------------------------------- > import Function ( Prim(..), Function(..) ) ----------------------------------------------------------------------
---------------------------------------------------------------------- > replace :: (Function, Function) -> Function -> Function > replace b@(g, h) f > | g == f = h > | otherwise = replace' b f ----------------------------------------------------------------------
---------------------------------------------------------------------- > replace' b (Derive n f) = Derive n (replace b f) > replace' b (f :.: g) = replace b f :.: replace b g > replace' b (Summ fs) = Summ [ replace b f | f<-fs ] > replace' b (Prod fs) = Prod [ replace b f | f<-fs ] > replace' b (f :^: g) = replace b f :^: replace b g > replace' b f = f ----------------------------------------------------------------------
Go to the first, previous, next, last section, table of contents.