Comment detail

2進数の記述 (Nested Flatten)

This comment is reply for 4578 naoto: Gaucheならそのまま書けますね。(2進数の記述). Go to thread root.

なんとなく36進数まで対応してみました。
もっと良い方法がありそうですが。

10:user> #,(r 2 "01101001")
=> 105
11:user> #,(r 16 "ff")
=> 255
12:user> #,(r 36 "10")
=> 36
1
2
3
(define-reader-ctor 'r
  (lambda (radix string)
    (string->number string radix)))

Index

Feed

Other

Link

Pathtraq

loading...