Comments (11)
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.
It could be done for any base.
Both base 2 and base 10 would be useful.
from monocle.
or any base from 2 to 36 like http://hackage.haskell.org/package/lens-4.1.2/docs/Numeric-Lens.html
from monocle.
@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.
right, if someone provide all values of a base then it is easy to make the mapping
from monocle.
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.
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.
@julien-truffaut Well we could generalize such things efficiently with Spire...
from monocle.
BTW, I started working on this.
from monocle.
We could generalize the number parsing with Abilian Group too.
from monocle.
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)
- Compilation error when importing cats.syntax.all HOT 7
- Cannot generate lens for case classes inheriting traits HOT 2
- TraversalLaws.headOption invalidated for underlying null values HOT 2
- MatchError using `as` inside Focus HOT 4
- Focus has trouble inferring index for types with existential parameter HOT 1
- Add refocus for Scala 2
- maven badge on website HOT 1
- Compilation error with context bounds HOT 8
- [Focus] Compilation fails in Scala 3 in nested case class/object
- Bring back Native support? HOT 5
- Ambient `opaque type` breaks `MkFocus` HOT 4
- Plated.transformOf isn't working properly
- change branch protection rule HOT 3
- Prepare next release HOT 18
- problem with sum type and focus HOT 1
- Mononcle doesn't support `@Lenses` in Scala3. HOT 10
- Should withDefault be available on lenses with a polymorphic source?
- How to Focus on a nested option HOT 4
- Autocomplete doesn't work HOT 4
- Lens macro-generated for a specific field should allow introspecting the name HOT 2
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 monocle.