Comments (6)
I think the main point is being missed here. Is EDN supposed to support ratios? If so, the spec needs to include it. If not, then why have a de facto reference implementation support extensions out of spec? (This being one among several exceptions.)
There's a separate issue on what to do for host languages, but can anyone address the spec issue? Actually, any sign of life on this spec would be nice to see. It appears to be 4 years since a spec question was posed and answered by anyone.
from edn.
@Ticking Since there is no built-in ratio type in Python, any suggestions on what would be the ideal way to handle this?
from edn.
@swaroopch To me it seems that there is a module in the python std lib since 2.6 called fractions which introduces a ratio type.
EDIT:
Nevertheless the problem of a target language not supporting different EDN types seems to be a reasonable concern. So the question is, how is this handled for other datatypes (e.g. symbols and keywords)?
edn_python
seems to go with custom classes for keywords and symbols. Would this be appropriate for ratios as well or should it fall back and turn the ratio into a simple float?
from edn.
@Ticking Sorry for my confusion, I thought this was a issue raised on my own edn_format
Python library, I didn't realize before that this issue was raised on the EDN spec. But to follow up, I have implemented the same for my library - swaroopch/edn_format#23
from edn.
It doesn't look like the Ratio type is supported by edn-ruby either:
~ # irb
2.2.0 :001 > require 'edn'
=> true
2.2.0 :002 > EDN.read("24")
=> 24
2.2.0 :003 > EDN.read('"asdf"')
=> "asdf"
2.2.0 :004 > EDN.read('3/25')
=> 3
from edn.
It doesn't look like the Ratio type is supported by edn-ruby either:
~ # irb 2.2.0 :001 > require 'edn' => true 2.2.0 :002 > EDN.read("24") => 24 2.2.0 :003 > EDN.read('"asdf"') => "asdf" 2.2.0 :004 > EDN.read('3/25') => 3
Hi, just stumbled upon this while thinking about this in regards to edn-ruby
.
I'm the developer of edn_turbo, a gem that implements a Ragel-based C-parser plugin replacement for edn-ruby
's native one. Although edn-ruby
does not support Ratio literals, I've implemented support in edn_turbo
using ruby Rationals. Released in v0.6.1 of the gem, available via rubygems.
from edn.
Related Issues (20)
- Reference implementation of an edn printer HOT 1
- The edn spec inaccurately describes what characters are allowed in symbols. HOT 3
- json-ld, #iri HOT 1
- Support for not-a-number or non-finite floating point values HOT 1
- Single-quote is not mentioned as a valid symbol character HOT 5
- Spec allows consecutive colons in symbols and keywords HOT 3
- Can Keywords contain escape characters? HOT 1
- Support for cyclic data HOT 2
- Tagged Elements Issue? HOT 3
- Make the spec concrete already HOT 5
- edn spec does not yet include namespace map syntax
- How are consumers supposed to handle values with unrecognized tags? HOT 1
- Reader flag to support unicode escapes in string literals HOT 2
- ns alias HOT 2
- Issue in the spec for keywords
- Alternative string quote syntax HOT 7
- An example of edn file HOT 1
- BNF is absent
- Provide a testsuite for EDN format
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from edn.