annotate 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
rev   line source
adam@11 1 fun numFields [r ::: {Type}] (fl : folder r) (r : $r) : int =
adam@11 2 @fold [fn _ => int] (fn [nm ::_] [u ::_] [r ::_] [[nm] ~ r] acc => acc+1) 0 fl
adam@11 3
adam@10 4 fun mem [a ::: Type] [ns ::: {Unit}] (_ : eq a) (fl : folder ns) (x : a) (r : $(mapU a ns)) : bool =
adam@10 5 @foldUR [a] [fn _ => bool]
adam@10 6 (fn [nm ::_] [r ::_] [[nm] ~ r] y acc =>
adam@10 7 acc || x = y)
adam@10 8 False fl r