ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - jfacorro/Eden: edn (extensible data notation) encoder/decoder for Elixir
edn (extensible data notation) encoder/decoder for Elixir - jfacorro/Eden
Visit Site

GitHub - jfacorro/Eden: edn (extensible data notation) encoder/decoder for Elixir

GitHub - jfacorro/Eden: edn (extensible data notation) encoder/decoder for Elixir

Eden

GitHub Hex.pm Hexdocs.pm Hex.pm Hex.pm GitHub

edn (extensible data notation) encoder/decoder implemented in Elixir.

Usage

Include Eden as a dependency in your Elixir project by adding it in your deps list:

def deps do
  [{:eden, "~> 0.1.2"}]
end

Eden is a library application and as such doesn't specify an application callback module. Even so, if you would like to build a release that includes Eden, you need to add it as an application dependency in your mix.exs:

  def application do
    [applications: [:eden]]
  end

Examples

iex> Eden.encode([1, 2])
{:ok, "(1, 2)"}

iex> Eden.encode(%{a: 1, b: 2, c: 3})
{:ok, "{:a 1, :b 2, :c 3}"}

iex> Eden.encode({:a, 1})
{:error, Protocol.UndefinedError}

iex> Eden.decode("{:a 1 :b 2}")
{:ok, %{a: 1, b: 2}}

iex> Eden.decode("(hello :world \\!)")
{:ok, [%Eden.Symbol{name: "hello"}, :world, %Eden.Character{char: "!"}]

iex> Eden.decode("[1 2 3 4]")
{:ok, #Array<[1, 2, 3, 4], fixed=false, default=nil>}

iex> Eden.decode("nil true false")
{:ok, [nil, true, false]}

iex> Eden.decode("nil true false .")
{:error, Eden.Exception.UnexpectedInputError}

Data Structures Mapping: edn <-> Elixir

Edn Elixir
nil :nil = nil
true :true = true
false :false = false
string String
character Eden.Character
symbol Eden.Symbol
keyword Atom
integer Integer
float Float
list List
vector Array
map Map
set MapSet
#inst Timex.DateTime
#uuid Eden.UUID

Further Considerations

Character

There is no way of distinguishing a common integer from the representation of a character in a String or in Char lists. This forces the creation of a new representation for this type so it can be correctly translated from and to edn.

Arbitrary Precision Integer and Float

The Erlang VM (EVM) only provides arbitrary precision integers so all integers will be of this type this and the N modifier will be ignored when parsing an edn integer.

On the other hand native arbitrary precision floating point numbers are not provided by the EVM so all values of type float will be represented according to what the EVM supports.

Keyword and Symbol Representation

On one hand the decision to translate edn keywords as Elixir atoms comes from the fact these two data types are given a similar usage on both languages. On the other, it might get awkward really fast using a new Eden.Symbol struct as the representation for edn's symbols so this might change.

vector

There is no constant lookup or nearly constant indexed data structure like edn's vector other than the :array data structure implemented in one of Erlang's standard library modules. Until there is a better implementation for this Eden will use Array, an Elixir wrapper library for Erlang's array.

edn grammar

expr -> literal | map | list | vector | tagged_value

literal -> nil | true | false | keyword | symbol | integer | float | string

map -> { pair* }
pair -> expr expr

list -> ( expr* )

vector -> [ expr* ]

tagged_value -> tag expr

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory