Product Promotion
0x5a.live
for different kinds of informations and explorations.
GitHub - meh/elixir-datastructures: Datastructures for Elixir.
Datastructures for Elixir. Contribute to meh/elixir-datastructures development by creating an account on GitHub.
Visit SiteGitHub - meh/elixir-datastructures: Datastructures for Elixir.
Datastructures for Elixir. Contribute to meh/elixir-datastructures development by creating an account on GitHub.
Powered by 0x5a.live ๐
Datastructures for Elixir
This is a collection of protocols, implementations and wrappers to work with datastructures.
The stdlib of Elixir right now is very poor and every now so you end up using the Erlang libraries, which have different APIs from the rest of idiomatic Elixir, and on top of that they lose all the protocol goodies.
Protocols
Sequence
first/1
- returns the first element in the sequence or nilnext/1
- returns a new sequence with the first element removed or nil
Counted
count
- returns the length of the structure
Emptyable
empty?/1
- checks if the structure is emptyclear/1
- returns an empty structure
Reducible
reduce/3
- reduces the structures
Sequenceable
to_sequence/1
- converts the structure to a sequence
Listable
to_list/1
- converts the structure to a list
Peekable
peek/1
- peeks and returns nil if the structure emptypeek/2
- peeks and returns the default value if the structure emptypeek!/1
- peeks and raises if the structure is empty
Reversible
reverse/1
- reverses the structure
Contains
contains?/2
- checks if the structure contains the passed value
Queue
enq/2
- enqueues a value in the structuredeq/1
- dequeues a value from the structure, returning nil if it's emptydeq/2
- dequeues a value from the structure, returning the default if it's emptydeq!/1
- dequeues a value from the structure, raising if it's empty
Stack
push/2
- pushes a value in the structurepop/1
- pops a value from the structure, returning nil if it's emptypop/2
- pops a value from the structure, returning the default if it's emptypop!/1
- pops a value from the structure, raising if it's empty
Set
add/2
- adds a value to the structuredelete/2
- deletes a value from the structureunion/2
- returns the union of the two structuresintersection/2
- returns the intersection of the two structuressubset?/2
- checks if the two structures are subsetsdisjoint?/2
- checks if the two structures are disjoint
Dictionary
get/2
- gets a value from the structure by its key, returning nil if there isn't oneget/3
- gets a value from the structure by its key, returning the default if there isn't oneget!/2
- gets a value from the structure by its key, raising if there isn't oneput/3
- puts a value in the structure with its keydelete/2
- delete a value from the structure by its keykeys/1
- returns a list of the keys in the structurevalues/1
- returns a list of the values in the structure
Helpers
Dict
get/2
- gets a value from the structure by its key, returning nil if there isn't oneget/3
- gets a value from the structure by its key, returning the default if there isn't oneget!/2
- gets a value from the structure by its key, raising if there isn't oneput/3
- puts a value in the structure with its keydelete/2
- delete a value from the structure by its keykeys/1
- returns a list of the keys in the structurevalues/1
- returns a list of the values in the structureput_new/3
- puts a value in the structure unless there's already one with that keyupdate/3
- updates the structure with an updater function, raises if there's no value with that keyupdate/4
- updates the structure with an updater function, the initial value is passed if there's no value with that key
Seq
with_index/1
- returns a sequence wrapping the sequence and returning indexesall?/1
- checks all elements in the sequence are truthyall?/2
- checks all elements are truthy with the given predicateany?/1
- checks if any element in the sequence is truthyany?/2
- checks if any element in the sequence is truthy with the given predicateat/2
- gets the element at the given index, returns nil if the sequence is shorterat/3
- gets the element at the given index, returns the default value if the sequence is shorterdrop/2
- drops the given number of elements from the sequencedrop_while/2
- drops elements from the sequence as long as the predicate returns a truthy valuetake/2
- take the given number of elements from the sequencetake_while/2
- take elements from the sequence as long as the predicate returns a truthy valueeach/2
- iterate over the sequenceselect/2
- filters the elements from the sequence returning the ones the predicate returns a truthy value forreject/2
- filters the elements from the sequence returning the ones the predicate returns a falsy value formap/2
- returns the sequence mapped with the given functionreduce/3
- reduce the sequencesort/1
- sort the sequencesort/2
- sort the sequence with the given predicatecount/1
- count the elements in the sequencecount/2
- count the elements in the sequence that match the predicatezip/2
- zip two sequences togethermax/1
- return the max value in the sequencemax/2
- return the max value in the sequence using a mappermin/1
- return the min value in the sequencemin/2
- return the min value in the sequence using a mapperuniq/1
- returns the elements without repetitionsuniq/2
- returns the elements without repetitions using a mapperreverse/1
- reverse the sequenceto_list/1
- convert the sequence to a list
You're awful, those names are long
I know right? Just use alias
.
alias Data.Set, as: S
alias Data.Set.BalancedTree, as: SBT
SBT.new |> S.add(23) |> S.add(42) # => #Set<[23,42]>
Elixir Resources
are all listed below.
GitHub - hamiltop/structurez: A playground for data structures in Elixir
resource
~/github.com
resource
GitHub - noizu-labs-ml/elixir-weaviate: Weaviate Rest Wrapper for Elixir
resource
~/github.com
resource
GitHub - elpassion/sprint-poker: Online estimation tool for Agile teams.
resource
~/github.com
resource
GitHub - jarednorman/canada: Easy permission definitions in Elixir apps!
resource
~/github.com
resource
GitHub - yesmeck/hexdocset: Convert hex doc to Dash.app's docset format.
resource
~/github.com
resource
GitHub - synrc/mad: โก MAD: Managing Application Dependencies LING/UNIX
resource
~/github.com
resource
GitHub - fuelen/owl: A toolkit for writing command-line user interfaces.
resource
~/github.com
resource
GitHub - dashbitco/flow: Computational parallel flows on top of GenStage
resource
~/github.com
resource
GitHub - jfrolich/smoothie: Beautiful emails for your elixir application
resource
~/github.com
resource
GitHub - mmmries/chunky_svg: An Elixir library for generating SVG images
resource
~/github.com
resource
GitHub - jsonmaur/phoenix-turnstile: Use Cloudflare Turnstile in Phoenix
resource
~/github.com
resource
GitHub - elixirstatus/phoenix_html_sanitizer: HTML Sanitizer for Phoenix
resource
~/github.com
resource
GitHub - meh/cauldron: I wonder what kind of Elixir is boiling in there.
resource
~/github.com
resource
GitHub - narrowtux/Tube: WebSocket client library written in pure Elixir
resource
~/github.com
resource
GitHub - Arp-G/pictionary: Picture guessing and drawing multiplayer game
resource
~/github.com
resource
GitHub - camshaft/world_json_ex: elixir module for the world in geo.json
resource
~/github.com
resource
GitHub - vectordotdev/timber-elixir: ๐ฒ Great Elixir logging made easy
resource
~/github.com
resource
GitHub - ikeikeikeike/exfavicon: Elixir library for discovering favicons
resource
~/github.com
resource
GitHub - kofigumbs/codec-beam: Generate Erlang VM byte code from Haskell
resource
~/github.com
resource
GitHub - edgurgel/verk: A job processing system that just verks! ๐งโ
resource
~/github.com
resource
GitHub - gausby/bencode: A bencode encoder and decoder written in Elixir
resource
~/github.com
resource
GitHub - bradleyd/exgrid: Elixir library to interact with Sendgrid's API
resource
~/github.com
resource
GitHub - avitex/elixir-vultr: Simple wrapper for the Vultr API in Elixir
resource
~/github.com
resource
GitHub - mhinz/vim-mix-format: Vim integration for the Elixir formatter.
resource
~/github.com
resource
GitHub - 81dr/ex_changerate: Elixir client for exchangerate platform API
resource
~/github.com
resource
Made with โค๏ธ
to provide different kinds of informations and resources.