Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
除了将值定义为小数(例如 2 = 10)之外,有没有人知道在方案中创建将数字转换为二进制的过程的方法?谢谢!
根据您的需要,有一个内置程序(number->string z radix)可以将数字转换为字符串,允许您指定数字基数。例如,将22(十进制)转换为10(二进制):
(number->string z radix)
22
10
huski> (number->string 22 2) "10110"
为了清楚起见,您将指定 2 作为第二个参数,因为二进制是 base-2。