Mercurial > meta
diff record.ur @ 11:67b33be5d56a
Record.numFields
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Thu, 03 Feb 2011 14:22:02 -0500 |
parents | 763eb2f2aa5a |
children | a6730c3cfea7 |
line wrap: on
line diff
--- a/record.ur Thu Feb 03 09:31:32 2011 -0500 +++ b/record.ur Thu Feb 03 14:22:02 2011 -0500 @@ -1,3 +1,6 @@ +fun numFields [r ::: {Type}] (fl : folder r) (r : $r) : int = + @fold [fn _ => int] (fn [nm ::_] [u ::_] [r ::_] [[nm] ~ r] acc => acc+1) 0 fl + fun mem [a ::: Type] [ns ::: {Unit}] (_ : eq a) (fl : folder ns) (x : a) (r : $(mapU a ns)) : bool = @foldUR [a] [fn _ => bool] (fn [nm ::_] [r ::_] [[nm] ~ r] y acc =>