Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edn (parse tree) -> Elixir #5

Closed
jfacorro opened this issue Jun 7, 2015 · 0 comments
Closed

edn (parse tree) -> Elixir #5

jfacorro opened this issue Jun 7, 2015 · 0 comments

Comments

@jfacorro
Copy link
Owner

jfacorro commented Jun 7, 2015

Data Structures Mapping: edn <-> Elixir

Edn Elixir
nil :nil = nil
true :true = true
false :false = false
string String
character ExEdn.Character
symbol ExEdn.Symbol
keyword Atom
integer Integer
float Float
list List
vector Array
map Map
set HashSet
#inst Timex.DateTime
#uuid ExEdn.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 to from and to edn.

Arbitrary Precision Integer and Float

The Erlang VM (EVM) only provides arbitrary precision integer so all integers will have this and the N modifier will be ignored when present.

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

The decision to translate keywords as atoms on the EVM comes form the common use these two data type are given. It might get awkward really quickly using a new ExEdn.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 ExEdn will use the Array, an Elixir wrapper library for Erlang's array.

jfacorro added a commit that referenced this issue Jun 8, 2015
jfacorro added a commit that referenced this issue Jun 8, 2015
jfacorro added a commit that referenced this issue Jun 9, 2015
jfacorro added a commit that referenced this issue Jun 9, 2015
jfacorro added a commit that referenced this issue Jun 9, 2015
jfacorro added a commit that referenced this issue Jun 9, 2015
jfacorro added a commit that referenced this issue Jun 9, 2015
@jfacorro jfacorro changed the title Generate Elixir data structures from parse tree edn (parse tree) -> Elixir Jun 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant