comparison lib/ur/top.ur @ 937:37dd42935dad

Summary row with aggregates
author Adam Chlipala <adamc@hcoop.net>
date Tue, 15 Sep 2009 10:18:56 -0400
parents 8e540df3294d
children 10114d7b7477
comparison
equal deleted inserted replaced
936:6966d98c80b5 937:37dd42935dad
103 fl [fn r :: {K} => $(map tf1 r) -> $(map tf2 r) -> $(map tf3 r)] 103 fl [fn r :: {K} => $(map tf1 r) -> $(map tf2 r) -> $(map tf3 r)]
104 (fn [nm :: Name] [t :: K] [rest :: {K}] [[nm] ~ rest] acc r1 r2 => 104 (fn [nm :: Name] [t :: K] [rest :: {K}] [[nm] ~ rest] acc r1 r2 =>
105 acc (r1 -- nm) (r2 -- nm) ++ {nm = f r1.nm r2.nm}) 105 acc (r1 -- nm) (r2 -- nm) ++ {nm = f r1.nm r2.nm})
106 (fn _ _ => {}) 106 (fn _ _ => {})
107 107
108 fun map3 [K] [tf1 :: K -> Type] [tf2 :: K -> Type] [tf3 :: K -> Type] [tf :: K -> Type]
109 (f : t ::: K -> tf1 t -> tf2 t -> tf3 t -> tf t) [r :: {K}] (fl : folder r) =
110 fl [fn r :: {K} => $(map tf1 r) -> $(map tf2 r) -> $(map tf3 r) -> $(map tf r)]
111 (fn [nm :: Name] [t :: K] [rest :: {K}] [[nm] ~ rest] acc r1 r2 r3 =>
112 acc (r1 -- nm) (r2 -- nm) (r3 -- nm) ++ {nm = f r1.nm r2.nm r3.nm})
113 (fn _ _ _ => {})
114
108 fun foldUR [tf :: Type] [tr :: {Unit} -> Type] 115 fun foldUR [tf :: Type] [tr :: {Unit} -> Type]
109 (f : nm :: Name -> rest :: {Unit} 116 (f : nm :: Name -> rest :: {Unit}
110 -> [[nm] ~ rest] => 117 -> [[nm] ~ rest] =>
111 tf -> tr rest -> tr ([nm] ++ rest)) 118 tf -> tr rest -> tr ([nm] ++ rest))
112 (i : tr []) [r :: {Unit}] (fl : folder r) = 119 (i : tr []) [r :: {Unit}] (fl : folder r) =