diff --git a/lama-spec.pdf b/lama-spec.pdf index dd6fccd73..2ba43769c 100644 Binary files a/lama-spec.pdf and b/lama-spec.pdf differ diff --git a/spec/08.standard_library.tex b/spec/08.standard_library.tex index a2c0b1004..f034ca658 100644 --- a/spec/08.standard_library.tex +++ b/spec/08.standard_library.tex @@ -196,6 +196,8 @@ Maps are immutable structures with the following interface: \descr{\lstinline|fun emptyMap (f)|}{Creates an empty map. An argument is a comparison function, which returns zero, positive or negative integer values depending on the order of its arguments.} +\descr{\lstinline|fun isEmptyMap (m)|}{Returns true if an argument map is empty.} + \descr{\lstinline|fun compareOf (m)|}{Returns a comparison function, associated with the map given as an argument.} \descr{\lstinline|fun addMap (m, k, v)|}{Adds a binding of a key "\lstinline|k|" to a value "\lstinline|v|" into a map "\lstinline|m|". As a result, a new map is @@ -226,6 +228,8 @@ Sets are immutable structures with the following interface: \descr{\lstinline|fun emptySet (f)|}{Creates an empty set. An argument is a comparison function, which returns zero, positive or negative integer values depending on the order of its arguments.} +\descr{\lstinline|fun isEmptySet (m)|}{Returns true if an argument set is empty.} + \descr{\lstinline|fun compareOf (m)|}{Returns a comparison function, associated with the set given as an argument.} \descr{\lstinline|fun addSet (s, v)|}{Adds an element "\lstinline|v|" into a set "\lstinline|s|" and returns a new set.} diff --git a/src/version.ml b/src/version.ml index 16abf3cd7..11b95bf31 100644 --- a/src/version.ml +++ b/src/version.ml @@ -1 +1 @@ -let version = "Version 1.10, f1384146c, Sun Mar 14 07:08:07 2021 +0300" +let version = "Version 1.10, 8359b674f, Sat Mar 20 13:46:03 2021 +0300" diff --git a/stdlib/Collection.lama b/stdlib/Collection.lama index 0e09bbe5c..2382a07b6 100644 --- a/stdlib/Collection.lama +++ b/stdlib/Collection.lama @@ -214,6 +214,10 @@ public fun emptyMap (compare) { [{}, compare] } +public fun isEmptyMap ([l, _]) { + case l of {} -> true | _ -> false esac +} + public fun addMap (m, k, v) { insertColl (m, k, v, Map) } @@ -251,6 +255,10 @@ public fun emptySet (compare) { [{}, compare] } +public fun isEmptySet (s) { + isEmptyMap (s) +} + public fun addSet (s, v) { insertColl (s, v, true, Set) }