Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/takscape/elixir-array
An Elixir wrapper library for Erlang's array
https://github.com/takscape/elixir-array
Last synced: 8 days ago
JSON representation
An Elixir wrapper library for Erlang's array
- Host: GitHub
- URL: https://github.com/takscape/elixir-array
- Owner: takscape
- Created: 2014-08-22T12:36:36.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2020-10-31T18:30:19.000Z (about 4 years ago)
- Last Synced: 2024-10-11T20:11:16.518Z (28 days ago)
- Language: Elixir
- Homepage:
- Size: 243 KB
- Stars: 34
- Watchers: 2
- Forks: 9
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - An Elixir wrapper library for Erlang's array. (Algorithms and Data structures)
- fucking-awesome-elixir - array - An Elixir wrapper library for Erlang's array. (Algorithms and Data structures)
- awesome-elixir - array - An Elixir wrapper library for Erlang's array. (Algorithms and Data structures)
README
# Array
An Elixir wrapper library for Erlang's array.
Supports Access, Enumerable and Collectable protocols.
## Using Array with Mix
To use array in your projects, add array as a dependency:```
def deps do
[{:array, "~> 1.0.1"}]
end
```Then run `mix deps.get` to install it.
## Documentation
http://code.void.in/docs/elixir-array/## Example
```
# Create
arr = Array.new()# Update
arr = Array.set(arr, 0, 100)# Access by indices
arr[0] # -> 0
arr[1000] # -> nil# Convert from/to list
Array.from_list([1,2,3,4,5])
Array.to_list(arr)# Transform using the Enum module
Array.from_list([1,2,3,4,5]) |> Enum.map(fn x -> 2*x end)
Enum.into(0..100, Array.new())# Comprehension
for v <- Array.from_list([1,2,3,4,5]), into: Array.new(), do: v*2
```