notes.org 643 B

Notes

How to display integers as bits?

#+BEGIN_SRC scheme :results output (display (format #t "~8'0,b~%" #b001100)) #+END_SRC

#+RESULTS:

00001100
#t

How to write integers using ones and zeros?

Write them as follows with the #b reader syntax:

#+BEGIN_SRC scheme :results output (display (simple-format #f "~a\n" #b10101001)) #+END_SRC

#+RESULTS:

169

How to write integers using hexadecimal numbers?

Write them as follows with the #x reader syntax:

#+BEGIN_SRC scheme :results output (display (simple-format #f "~a\n" #xff)) (display (simple-format #f "~a\n" #xFF)) #+END_SRC

#+RESULTS:

255
255