-
Notifications
You must be signed in to change notification settings - Fork 70
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
Added bits functions #1319
Added bits functions #1319
Conversation
Please keep the original argument order where the bytespec comes first. I actually think that's better for currying. I would also get rid of the bytespecs entirely. Just pass them as curried args. |
9195e4c
to
0f0c942
Compare
Changed the order, removed Bytespec |
0f0c942
to
b81a420
Compare
library/bits.lisp
Outdated
(cl:ldb (cl:byte size position) bitstring))) | ||
|
||
(declare bits->string (Bits :a => UFix -> :a -> String)) | ||
(define (bits->string width x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since x is a type class constrained type, it's not guaranteed to be a compatible Lisp value with FORMAT. you need to convert it to an integer for this to work, or extract the bits one by one
i suggest either fixing this or removing it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, I removed it.
It would fit better in a potential future Coalton formatting library anyways.
b81a420
to
ee3cf59
Compare
Added a few functions to
coalton-library/bits
.dpb
andldb
mimic their Common Lisp counterparts, following the same argument order.print-bits
is a handy debugging tool for printing bit types to a specified number of bits.