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

SRFI 33, 60, 151: bitwise operations on integers #15

Open
lassik opened this issue Jan 25, 2020 · 6 comments
Open

SRFI 33, 60, 151: bitwise operations on integers #15

lassik opened this issue Jan 25, 2020 · 6 comments

Comments

@lassik
Copy link
Collaborator

lassik commented Jan 25, 2020

@lassik
Copy link
Collaborator Author

lassik commented Jan 25, 2020

I'll implement 151. It's planned to be part of R7RS-large.

@feeley
Copy link
Member

feeley commented Jan 25, 2020

Will you also tackle SRFI 121 (Generators) that is used by SRFI 151?

To simplify your work I can implement the following natively: bitwise-eqv, bitwise-nand, bitwise-nor, bitwise-andc1, bitwise-andc2, bitwise-orc1, and bitwise-orc2 .

@lassik
Copy link
Collaborator Author

lassik commented Jan 25, 2020

Will you also tackle SRFI 121 (Generators) that is used by SRFI 151?

121 has been withdrawn in favor of 158 (Generators and Accumulators). Personally, I love these abstractions and think 158 is definitely worth having. If 158 is a compatible superset of 121, I guess it doesn't hurt to have both. However, if there isn't much existing Scheme code depending on 121, it may be best to encourage everyone to switch to 158.

To simplify your work I can implement the following natively: bitwise-eqv, bitwise-nand, bitwise-nor, bitwise-andc1, bitwise-andc2, bitwise-orc1, and bitwise-orc2 .

Awesome! That would be much appreciated.

@lassik
Copy link
Collaborator Author

lassik commented Jan 25, 2020

Aha, seems this bitwise SRFI (151) only refers to 121 by returning a generator from one procedure. No special support for 121 or 158 is needed to return a generator - it's just a closure taking no arguments and returning some objects followed by end-of-file, like read.

Anyway, 158 would be nice to have more generally since it has convenient higher-order functions for working with generators.

@lassik
Copy link
Collaborator Author

lassik commented Jan 25, 2020

Would it be worth supporting all the hash-table SRFIs and all the bitwise SRFIs in the next Gambit release? There are not many of them, and they can all share the same internals.

@lassik lassik changed the title SRFI 151: Bitwise Operations SRFI 33, 60, 151: bitwise operations on integers Jan 25, 2020
@lassik
Copy link
Collaborator Author

lassik commented Jan 25, 2020

We could probably implement large parts of the bitwise SRFIs by simply re-exporting identifiers from Gambit's core. Does Gambit currently support (only ...) and (rename ...) inside define-library import clauses, and can ## identifiers be imported in this way? Can we re-export from the (gambit) library?

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