LiiiLabs / goldfish

Goldfish Scheme / 金鱼Scheme
https://gitee.com/LiiiLabs/goldfish
Apache License 2.0
36 stars 9 forks source link

(liii bitwise) and (srfi srfi-151) #67

Open da-liii opened 1 month ago

da-liii commented 1 month ago

https://srfi.schemers.org/srfi-151/srfi-151.html

We need to create two new library to add bitwise support.

There are already logand, logor available in S7 Scheme, and adding srfi-151 support could make Goldfish Scheme more portable!

JackYansongLi commented 1 month ago

I've made a pull request which implemented bitwise-or and bitwise-and. A new library srfi-151 was added in Section 2.8 which is automatically imported by (liii base).

da-liii commented 1 month ago

I suggest we should keep the srfi-151 related code in (liii bitwise). That's my initial design. Bitwise operations are not defined in R7RS. We should not keep it in (liii base)

da-liii commented 1 month ago

(srfi srfi-151) is the impl, and (liii bitwise) is the interface

da-liii commented 1 month ago

The reason why SRFI-2 and SRFI-8 is exported in (liii base) is that there is only 1 routine in SRFI 2 and SRFI-8.

But for SRFI-151, there are many routines to be implemented. That's why it should be organized in (liii bitwise).

JackYansongLi commented 1 month ago

I've made a new pull request.

da-liii commented 16 hours ago

Bit Twiddling Hacks

https://graphics.stanford.edu/~seander/bithacks.html