関数型プログラミング言語Haskell Part8
at TECH
446:デフォルトの名無しさん
08/01/16 19:00:45
>>445
なぜか$!に慣れないのでseqを使ってるけど
toBaseN_loop_case :: Integer -> Integer -> [Integer]
toBaseN_loop_case n 0 = [0]
toBaseN_loop_case n x = f x []
where
f 0 ds = ds
f x ds = case divMod x n of
(r, q) -> f r (q:ds)
toBaseN_loop :: Integer -> Integer -> [Integer]
toBaseN_loop n 0 = [0]
toBaseN_loop n x = f x []
where
f 0 ds = ds
f x ds = let q = div x n; r = div x n in
q `seq` r `seq` f r (q:ds)
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
5324日前に更新/201 KB
担当:undef