Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ericmj/ex2ms
:ets.fun2ms for Elixir, translate functions to match specifications
https://github.com/ericmj/ex2ms
Last synced: 5 days ago
JSON representation
:ets.fun2ms for Elixir, translate functions to match specifications
- Host: GitHub
- URL: https://github.com/ericmj/ex2ms
- Owner: ericmj
- Created: 2013-06-29T18:11:33.000Z (over 11 years ago)
- Default Branch: main
- Last Pushed: 2024-06-13T18:27:11.000Z (5 months ago)
- Last Synced: 2024-10-13T09:52:37.078Z (23 days ago)
- Language: Elixir
- Homepage:
- Size: 65.4 KB
- Stars: 192
- Watchers: 8
- Forks: 27
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - Translates Elixir functions to match specifications for use with `ets`. (Miscellaneous)
- fucking-awesome-elixir - ex2ms - Translates Elixir functions to match specifications for use with `ets`. (Miscellaneous)
- awesome-elixir - ex2ms - Translates Elixir functions to match specifications for use with `ets`. (Miscellaneous)
README
# ex2ms
Translates Elixir functions to match specifications for use with `ets`.
Requires Elixir 1.0 or later.## Usage
Add ex2ms to your Mix dependencies:
```elixir
defp deps do
[{:ex2ms, "~> 1.0"}]
end
```In your shell write the following to get up and running to try ex2ms out:
```bash
mix deps.get
iex -S mix
``````elixir
iex(1)> import Ex2ms
iex(2)> fun do { x, y } = z when x > 10 -> z end
[{{:"$1",:"$2"},[{:>,:"$1",10}],[:"$_"]}]
iex(3)> :ets.test_ms({ 42, 43 }, v(2))
{:ok,{42,43}}
iex(4)> :ets.test_ms({ 0, 10 }, v(2))
{:ok,false}
```## License
Copyright 2013 Eric Meadows-Jönsson
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.