Skip to content

GearsDatapacks/gleam-mapped

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mapped

Package Version Hex Docs

An implementation of a Bidirectional Map (BiMap) in pure Gleam.

gleam add mapped@1
import mapped

pub fn main() {
  let numbers_to_words = mapped.from_list([
    #(1, "one")
    #(2, "two")
    #(3, "three")
    #(4, "four")
    #(5, "five")
  ])
  
  let assert Ok(word) = mapped.get_by_left(4) // -> "four"
  let assert Ok(number) = mapped.get_by_right("three") // -> 3
}

Further documentation can be found at https://hexdocs.pm/mapped.

Development

gleam run   # Run the project
gleam test  # Run the tests

About

An implementation of a Bidirectional Map in Gleam

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages