Title here
Summary here
Our first program will explore the usage of maps, which are key-value data structures. Here’s the full source code translated into PureScript.
Map.empty
to create an empty map of type Map String Int
.Map.insert
to add key-value pairs to the map.log
and show
are used to print the map in a readable format.Map.lookup
is used to retrieve the value associated with a particular key.Map.lookup
returns Nothing
.Map.size
to obtain the number of key-value pairs.Map.delete
function removes a specified key from the map.Map.empty
to clear all key-value pairs.Map.member
to check if a key exists in the map.Map.fromFoldable
initializes a new map with given key-value pairs.Now that we have explored map functionalities, let’s dive deeper into other aspects of PureScript.