mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-05 22:38:44 +00:00
Added isEmptySet/isEmptyMap
This commit is contained in:
parent
8359b674f8
commit
849162aa92
4 changed files with 13 additions and 1 deletions
BIN
lama-spec.pdf
BIN
lama-spec.pdf
Binary file not shown.
|
|
@ -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.}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue