Is there a some form of a dictionary in motoko? I seem to remember from a demo video that it was possible but when looking in the language guide around mutable state section and the standard library I can’t seem to find a dictionary structure.
Edit: just noticed these line in the linkedup code
import Trie "mo:stdlib/trie.mo";
type Trie<Key, Value> = Trie.Trie<Key, Value>;
This Trie type seems to have a key value structure but I can’t find any documentation around it
Hmm when trying the phonebook actor code I get the following error:
IDL generation returned an error:
/Users/dfinitybasics/hello/src/hello/main.mo:1.1-1.26: import error, file "/Users/dfinitybasics/.cache/dfinity/versions/0.4.13/stdlib/list" does not exist
/Users/dfinitybasics/hello/src/hello/main.mo:2.1-2.31: import error, file "/Users/dfinitybasics/.cache/dfinity/versions/0.4.13/stdlib/assocList" does not exist
Does anyone know what could cause this? I’m using the exact same import statements as in the phonebook example. I double checked for capital letters
Edit: I fixed it by putting .mo behind the import statements like this
import L “mo:stdlib/list.mo”;
import A “mo:stdlib/assocList.mo”;
Does anybody have the same problem because then maybe the phonebook example should be updated.
Yes the import in the example there does need updating (it’s been flagged).
The .mo extension will likely be removed from imports on the next release too so keep that in mind, you’ll notice the docs are being updated to reflect this.