Seasons.NET

ちょっとした技術ブログです

Haskell

Win32用のDLLにHaskell封じ込めて使う

12.6. Win32のDLLをビルド・利用する 12.6. Building and using Win32 DLLs HaskellのDLLを作ってRubyから呼ぶ - 趣味的にっき メモです。

Hello Worldやってみた。

anarchy golf - hello world まぁ、簡単だからこそですが^^;

VistaでHaskellを使う時の注意点

GHC: Download version 6.6.1 Vistaで動かす時は、PATHに以下の記事で書かれているようにlibにも通しておくこと。 http://d.hatena.ne.jp/kikaineko/20070602

ghc66リリース

うちのcoLinux Fedora6に入れたghc66-6.6-1.fc6 http://fedoraproject.org/extras/6/i386/repodata/repoview/__nogroup__.group.htmlあと依存パッケージは、 gmp-devel

ふつける練習問題を解く!!

Seasonsなりに解いていく課程。 解くことが前提なので、最適化などは、あとまわし。[ ]空リストは、はてな記法と重なるのであえてスペースいれてますのでコピペ注意!! ふつける練習問題1 ふつける練習問題2 ふつける練習問題3 ふつける練習問題4 ふつける…

ふつける練習問題その6

この問題あたりから、Seasons独自というか勢いなコードが見受けられる・・・ もっとフリーポイントスタイルを・・・ 1 -- 標準入力から読み込んだ各行を幅60バイトに収まるように折り返すコマンド 2 -- foldを書きなさい。単語境界やマルチバイト文字は考え…

ふつける練習問題その5

1 -- 同じ行が連続していたらまとめるコマンド uniq を作成しなさい 2 import List 3 import System 4 5 -- 割と読みやすいほう 6 main = do args <- getArgs 7 contents <- readFile (head args) 8 putStrLn $ unlines $ groupLines $ lines contents 9 10 …

ふつける練習問題その4

1 -- リストをソートする 2 import List 3 import System 4 5 main = do args <- getArgs 6 contents <- readFile (head args) 7 putStrLn $ unlines $ sortLine $ lines contents 8 9 sortLine :: [String] -> [String] 10 sortLine cs = sort cs

ふつける練習問題その3

1 --- 標準入力から読み込んだ 'a'と'A'を入れ替えるコマンド swapA 2 import System 3 4 main = do cs <- getArgs 5 print $ map swapA (concat cs) 6 7 swapA :: Char -> Char 8 swapA 'a' = 'A' 9 swapA 'A' = 'a' 10 swapA c = c

ふつける練習問題その2

1 -- 標準入力から読んだワード数を数えるコマンド countWords 2 main = do cs <- getContents 3 print $ countWords $ lines cs 4 5 countWords :: [String] -> Int 6 countWords [ ] = 0 7 countWords (cs:c) = (length $ (words cs)) + countWords c

ふつける練習問題その1

本来の答えと違うかもしれないけど、こういうのもあり? 1 -- 標準入力から読んだバイト数を数えるコマンド countByte 2 main = do cs <- getContents 3 print $ countByte $ lines cs 4 5 countByte :: [String] -> Int 6 countByte [ ] = 0 7 countByte (c…

学習その1

1 -- こんなファイルがあったとき 2 -- 3 -- size.txt 4 -- 100 5 -- 10 6 -- 1024 7 -- 8 -- size.hs <- size.txt 9 -- 10 -- FileSize:100 11 -- FileSize:10 12 -- FileSize:1024 13 -- 14 -- と出力する 15 main = do cs <- getContents 16 putStrLn $ u…

なんと、青木さんが!!書いている!!入門Haskellの次に買おうと思っている本。サポートページは、ここふつうのHaskellプログラミング ふつうのプログラマのための関数型言語入門作者: 青木峰郎,山下伸夫出版社/メーカー: ソフトバンククリエイティブ発売日…