Giter Site home page Giter Site logo

Comments (6)

SeaJaredCode avatar SeaJaredCode commented on August 26, 2024 2

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.

swaroopch avatar swaroopch commented on August 26, 2024

@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.

 avatar commented on August 26, 2024

@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.

swaroopch avatar swaroopch commented on August 26, 2024

@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.

rschmitt avatar rschmitt commented on August 26, 2024

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.

edporras avatar edporras commented on August 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.