Git Product home page Git Product logo

Comments (11)

julien-truffaut avatar julien-truffaut commented on July 17, 2024

good idea, it should be something like:
digits[T : Bits]: Iso[T, List[T]]
digits.get(3) == List(0, 0, ...., 1, 1)
digits.modify(1, reverse) == ~1

from monocle.

NightRa avatar NightRa commented on July 17, 2024

It could be done for any base.
Both base 2 and base 10 would be useful.

from monocle.

julien-truffaut avatar julien-truffaut commented on July 17, 2024

or any base from 2 to 36 like http://hackage.haskell.org/package/lens-4.1.2/docs/Numeric-Lens.html

from monocle.

NightRa avatar NightRa commented on July 17, 2024

@julien-truffaut Or any supplied base.
We could at first make a an iso to a list of divisors:
For example base 16 would have numbers in the range [0..15] in the list, and then map them accordingly to some sequence.

from monocle.

julien-truffaut avatar julien-truffaut commented on July 17, 2024

right, if someone provide all values of a base then it is easy to make the mapping

from monocle.

NightRa avatar NightRa commented on July 17, 2024

Oh I thought of a problem: We need to have an Iso between Int and a list of digits, not represented directly by ints.
If we had dependant types...

from monocle.

julien-truffaut avatar julien-truffaut commented on July 17, 2024

we probably want to create an Iso between a List of digits and a BigInt then we can create a Prism between BigInt and Int

from monocle.

NightRa avatar NightRa commented on July 17, 2024

@julien-truffaut Well we could generalize such things efficiently with Spire...

from monocle.

NightRa avatar NightRa commented on July 17, 2024

BTW, I started working on this.

from monocle.

NightRa avatar NightRa commented on July 17, 2024

We could generalize the number parsing with Abilian Group too.

from monocle.

julien-truffaut avatar julien-truffaut commented on July 17, 2024

From the recent activity on this ticket, I suppose no one is really interested by it. So I propose we close this issue.

from monocle.

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.