]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.runtime/scl/Set.scl
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scl.runtime / scl / Set.scl
diff --git a/bundles/org.simantics.scl.runtime/scl/Set.scl b/bundles/org.simantics.scl.runtime/scl/Set.scl
new file mode 100644 (file)
index 0000000..2bf2911
--- /dev/null
@@ -0,0 +1,23 @@
+import "Iterator" as Iterator
+
+importJava "java.util.Set" where
+    data T a
+    
+    contains :: T a -> a -> Boolean
+    size :: T a -> Integer
+    isEmpty :: T a -> Boolean
+    
+    @private
+    iterator :: T a -> Iterator.T a
+
+@inline
+iter :: (a -> <e> ()) -> T a -> <e> ()
+iter f s = runProc (Iterator.iter f (iterator s))
+
+@inline
+iterB :: (a -> <e> Boolean) -> T a -> <e> Boolean
+iterB f s = runProc (Iterator.iterB f (iterator s))
+
+@inline
+fold :: (a -> b  -> <e> a) -> a -> T b -> <e> a
+fold f init s = runProc (Iterator.fold f init (iterator s))