We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ff83de2 commit 5280a76Copy full SHA for 5280a76
www/notes/utils.rkt
@@ -36,14 +36,20 @@
36
(define (save-file f s)
37
(with-output-to-file f (λ () (display s)) #:exists 'replace))
38
39
-(define (binary i [len 0])
+(define (base i b [len 0])
40
(typeset-code #:block? #f #:indent 0
41
- (string-append "#b"
42
- (~a (number->string i 2)
+ (string-append "#"
+ (case b [(2) "b"] [(16) "x"])
43
+ (~a (string-upcase (number->string i b))
44
#:left-pad-string "0"
45
#:align 'right
46
#:min-width len))))
47
48
+(define (hex i [len 0])
49
+ (base i 16 len))
50
+(define (binary i [len 0])
51
+ (base i 2 len))
52
+
53
(define (src-code lang)
54
(margin-note (small-save-icon) " "
55
(link (string-append "code/" (string-downcase lang) ".zip") "Source code")
0 commit comments