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

Add Iso for Int and List of digits. #34

Closed
NightRa opened this issue Mar 27, 2014 · 11 comments
Closed

Add Iso for Int and List of digits. #34

NightRa opened this issue Mar 27, 2014 · 11 comments

Comments

@NightRa
Copy link
Collaborator

NightRa commented Mar 27, 2014

Add Iso for Int and List of digits.

@julien-truffaut
Copy link
Member

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

@NightRa
Copy link
Collaborator Author

NightRa commented Mar 29, 2014

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

@julien-truffaut
Copy link
Member

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

@NightRa
Copy link
Collaborator Author

NightRa commented Apr 1, 2014

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

@julien-truffaut
Copy link
Member

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

@NightRa
Copy link
Collaborator Author

NightRa commented Apr 12, 2014

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

@NightRa NightRa closed this as completed Apr 12, 2014
@NightRa NightRa reopened this Apr 12, 2014
@julien-truffaut
Copy link
Member

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

@NightRa
Copy link
Collaborator Author

NightRa commented Apr 14, 2014

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

@NightRa
Copy link
Collaborator Author

NightRa commented Apr 14, 2014

BTW, I started working on this.

@NightRa
Copy link
Collaborator Author

NightRa commented Apr 14, 2014

We could generalize the number parsing with Abilian Group too.

@julien-truffaut
Copy link
Member

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

@NightRa NightRa closed this as completed Apr 23, 2016
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

2 participants