# HG changeset patch # User Adam Chlipala # Date 1296760922 18000 # Node ID 67b33be5d56afa424d1c467b32e84dc8cc4dcff5 # Parent 763eb2f2aa5ae59aee4ac1202e9ad97f773c11ea Record.numFields diff -r 763eb2f2aa5a -r 67b33be5d56a record.ur --- 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 => diff -r 763eb2f2aa5a -r 67b33be5d56a record.urs --- a/record.urs Thu Feb 03 09:31:32 2011 -0500 +++ b/record.urs Thu Feb 03 14:22:02 2011 -0500 @@ -1,2 +1,4 @@ +val numFields : r ::: {Type} -> folder r -> $r -> int + val mem : a ::: Type -> ns ::: {Unit} -> eq a -> folder ns -> a -> $(mapU a ns) -> bool (* Is a value found in a record? *)