Git Product home page Git Product logo

Comments (2)

pkoch avatar pkoch commented on June 30, 2024 1

Obviously, this doesn't account for division by zero though: it might be necessary to have some way to express that a value is non-zero in the type system, such as through dependent types.

Yeah, this was more my point. I see you've resisted the common cheat of making Zero - Succ(Zero) == Zero, I was wondering what you have in mind to prevent zero divisions. They do feel like something a dependent type system can tackle. However, I've never seen in implemented, hence the question.

Cheers, and great work! 👏

from tao.

zesterer avatar zesterer commented on June 30, 2024

For reals, division is already total. For integers, there are two options:

  • Have the output type of division be Real (there is already precedent for this, negation on a Nat yields an Int)
  • Have the output type be (Nat, Nat) (i.e: integer division + remainder)

I think I'd tend towards the former as the more natural option, with the latter as an independent function.

Obviously, this doesn't account for division by zero though: it might be necessary to have some way to express that a value is non-zero in the type system, such as through dependent types.

Ideas are welcome!

from tao.

Related Issues (7)

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.