Skip to content

Commit

Permalink
upload new map.ak file and functions and tests. This invariant is lik…
Browse files Browse the repository at this point in the history
…e dict with keys that can be any type and ordering is unspecified.
  • Loading branch information
MicroProofs authored and KtorZ committed May 1, 2024
1 parent 2df2aa8 commit 4dc6672
Show file tree
Hide file tree
Showing 3 changed files with 819 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/aiken/dict.ak
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub opaque type Dict<key, value> {
inner: Map<ByteArray, value>,
}

/// Create a new map
/// Create a new dict
/// ```aiken
/// dict.to_map(dict.new()) == []
/// ```
Expand Down Expand Up @@ -194,7 +194,7 @@ test filter_3() {
/// |> dict.insert(key: "c", value: 42)
/// |> dict.find(42)
///
/// result == Some("c")
/// result == Some("a")
/// ```
pub fn find(self: Dict<key, value>, value v: value) -> Option<ByteArray> {
do_find(self.inner, v)
Expand Down Expand Up @@ -686,7 +686,8 @@ test insert_2() {
}

/// Insert a value in the dictionary at a given key. When the key already exist, the provided
/// merge function is called.
/// merge function is called. The value existing in the dictionary is passed as the second argument
/// to the merge function, and the new value is passed as the third argument.
///
/// ```aiken
/// let sum =
Expand Down
Loading

0 comments on commit 4dc6672

Please sign in to comment.