-
Notifications
You must be signed in to change notification settings - Fork 660
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
[Feature] Char + String Static Circuit Methods #948
Comments
Realizing an issue here. We cannot implement a static circuit with methods on |
Very good point. For now we can just implement the ones with known sizes, such as |
Supporting types parameterized on (constant) values is a feature that's been discussed, and that will help support constant-value-generic functions on arrays in general, but it's a separate feature. |
Question, would we rather these circuits live in |
Sure, that could be another way to go. I don't have strong personal preferences one way or the other. It will be also easy to "move" from one approach to the other in the future if desired: add the new functions, deprecate the old ones, then remove them. Unless somebody has strong preferences, perhaps we should go with what's easiest. Do you think it's easier to go the |
Blocked by #975. |
|
🚀 Feature
We should have a
Circuit
for eachchar
andstring
containing methods we want to have for these types.Depends on #929.
Depends on #975.
Depends on #976.
Motivation
To allow users to have methods that perform on these types.
This offers a convivence so that users do not have to implement these from scratch.
Implementation
AST
Circuit
into the AST.Circuit
type we wish to introduce.Char Methods
is_alphabetic
- Returnstrue
if thechar
has theAlphabetic
property.is_ascii
- Returnstrue
if thechar
is in theASCII
range.is_ascii_alphabetic
- Returnstrue
if thechar
is in theASCII Alphabetic
range.is_lowercase
- Returnstrue
if thechar
has theLowercase
property.is_numeric
- Returnstrue
if thechar
has one of the general categories for numbers.is_uppercase
- Returnstrue
if thechar
has theUppercase
property.is_whitespace
- Returnstrue
if thechar
has theWhite_Space
property.to_digit
- Converts thechar
to the givenradix
format.from_digit
- Inverse of to_digit.to_uppercase
- Converts lowercase to uppercase, leaving others unchanged.to_lowercase
- Converts uppercase to lowercase, leaving others unchanged.String Methods
u8
to[char; 2]
hexstring, ..,u128
to[char; 32]
hexstring.[char; 64]
hexstring. (Application can test leading zeros and slice them out if it needs to return, say, a 40-hex-digit string.)to_uppercase
(see above) to every character.to_lowercase
(see above) to every character.Tests
The text was updated successfully, but these errors were encountered: