changeset 10:763eb2f2aa5a

Record.mem
author Adam Chlipala <adam@chlipala.net>
date Thu, 03 Feb 2011 09:31:32 -0500
parents 8eaaca74a64c
children 67b33be5d56a
files lib.urp record.ur record.urs
diffstat 3 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lib.urp	Wed Dec 15 09:27:46 2010 -0500
+++ b/lib.urp	Thu Feb 03 09:31:32 2011 -0500
@@ -9,3 +9,4 @@
 sql
 parse
 html
+record
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/record.ur	Thu Feb 03 09:31:32 2011 -0500
@@ -0,0 +1,5 @@
+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 =>
+         acc || x = y)
+     False fl r
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/record.urs	Thu Feb 03 09:31:32 2011 -0500
@@ -0,0 +1,2 @@
+val mem : a ::: Type -> ns ::: {Unit} -> eq a -> folder ns -> a -> $(mapU a ns) -> bool
+(* Is a value found in a record? *)