Changeset 20925 for lang/haskell/nario/Util.hs
- Timestamp:
- 10/07/08 20:42:00 (3 months ago)
- Files:
-
- 1 modified
-
lang/haskell/nario/Util.hs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/haskell/nario/Util.hs
r20670 r20925 7 7 replace ls i v = take i ls ++ [v] ++ drop (i + 1) ls 8 8 9 -- 符号を返す 9 -- けつの n 個取り出し 10 lastN 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 -- 数値の符号を返す 10 17 sgn x 11 18 | x > 0 = 1 12 19 | x < 0 = -1 13 20 | otherwise = 0 21 22 -- 10進数 n 桁文字列を返す 23 deciWide n c = lastN n . (replicate n c ++) . show 14 24 15 25 -- x に d を加算した結果が x0~x1 の範囲内を超えないようにする
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)