Show
Ignore:
Timestamp:
10/07/08 20:42:00 (3 months ago)
Author:
mokehehe
Message:

ソース整理

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/haskell/nario/Util.hs

    r20670 r20925  
    77replace ls i v = take i ls ++ [v] ++ drop  (i + 1) ls 
    88 
    9 -- 符号を返す 
     9-- けつの n 個取り出し 
     10lastN n xs = loop n [] xs 
     11        where 
     12                loop _ acc [] = acc 
     13                loop 0 acc (x:xs) = loop 0 (tail acc ++ [x]) xs 
     14                loop n acc (x:xs) = loop (n-1) (acc ++ [x]) xs 
     15 
     16-- 数値の符号を返す 
    1017sgn x 
    1118        | x > 0         = 1 
    1219        | x < 0         = -1 
    1320        | otherwise     = 0 
     21 
     22-- 10進数 n 桁文字列を返す 
     23deciWide n c = lastN n . (replicate n c ++) . show 
    1424 
    1525-- x に d を加算した結果が x0~x1 の範囲内を超えないようにする