2
INT我有這樣的代碼,以十六進制轉換爲字節串轉換字節字符串在方案
(define (word->bin s)
(let ((n (string->number s)))
(bytes (bitwise-and (arithmetic-shift n -24) #xFF)
(bitwise-and (arithmetic-shift n -16) #xFF)
(bitwise-and (arithmetic-shift n -8) #xFF)
(bitwise-and n #xFF))))
(word->bin "#x10000002")
我想類似的功能,以二進制轉換成整數,然後打印。最終結果是將二進制轉換爲十六進制。一些有用的鏈接: http://download.plt-scheme.org/doc/372/html/mzscheme/mzscheme-Z-H-11.html#node_sec_11.2.1
謝謝,我很驚訝,老師並沒有提及這 – yuguang
好吧,如果這是一門功課的一部分,那麼你的老師可能需要你寫一個解決方案。 –