This comment is reply for 4553 anekos: (2進数の記述). Go to thread root.
anekos #4563(2007/12/02 12:52 GMT) [ Haskell ] Rating1/1=1.00
Template Haskell を使ってみた。 2ファイルあります。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
{- binmain.hs -} import Bin main = print $(b 01101001) {- bin.hs -} module Bin (b) where import Language.Haskell.TH bin :: Integer -> Integer bin 0 = 0 bin x = bin' x + 2 * bin (div x 10) where bin' x = if odd x then 1 else 0 b x = litE $ IntegerL $ bin x {- >> ghc --make -fth binmain.hs >> ./binmain 105 -
Rating1/1=1.00-0+
[ reply ]
anekos
#4563()
[
Haskell
]
Rating1/1=1.00
Template Haskell を使ってみた。 2ファイルあります。
Rating1/1=1.00-0+