annotate record.ur @ 17:1a915f89f23a
Update for a change to Ur/Web tag encoding
author |
Adam Chlipala <adam@chlipala.net> |
date |
Thu, 29 Dec 2011 10:10:50 -0500 |
parents |
a6730c3cfea7 |
children |
6cd839818393 |
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
|
adam@12
|
9
|
adam@12
|
10 fun equal [ts ::: {Type}] (eqs : $(map eq ts)) (fl : folder ts) (r1 : $ts) (r2 : $ts) : bool =
|
adam@12
|
11 @foldR3 [eq] [id] [id] [fn _ => bool]
|
adam@12
|
12 (fn [nm ::_] [t ::_] [r ::_] [[nm] ~ r] isEq x y acc =>
|
adam@12
|
13 acc && @eq isEq x y)
|
adam@12
|
14 True fl eqs r1 r2
|