サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
大谷翔平
madscientist.jp
madscientist.jp/~ikegami
_ Gloss 入門 Haskell の 2D グラフィックスライブラリ Gloss の入門記事です。 Haskell で 2D グラフィックスするのはどうすんの : Stack Overflowで紹介されていたので試してみました。あと、前回の関西Codersで、流体シミュレーションを Java で、というのを見せてもらったので、それを Haskell で書いたらどうなるのかなーという興味もありました。Gloss のサンプルのひとつ Styrene は粒子シミュレーションになっていて、これを見るかぎり粒子が多くなければスムーズに動きそうです。 インストールの方法や、ドキュメントは公式ページをみてください。 Gloss トップページ Gloss : HackageDB Glossは、OpenGL と GLUT をベースにした 2D グラフィックスライブラリです。 OpenGL や GLUT
数列と多項式の愛しい関係 自然数の有限数列 (ai)i=0n と無限数列 (fi)i=0∞ を考える。 具体例: (a0,a1,a2)=(1,1,1) (fi)i=0∞=(1,1,1,...,1,...) これらの数列について、対応する多項式をつくる。 この作り方がどうして嬉しいのか、を説明しないのがこの文書の目的である。 えっ。説明はしないが、不思議な現象をお見せする。 正しいのか正しくないのか、その説明には様々な道具が必要になるので、 ページの長さの都合で全てを証明するわけにはいかない。 もしわからないところがあったら、間違っていないかどうか証明を試みてほしい。 ポイントで参照すべき資料を明示する。すべてというわけにはいかないけれども。 多項式の文字として zi を用いることにする。添字 i は 0 から ∞ までを動く。 たとえば、つぎのような多項式: z0z1z2 Σi=0∞zi
_ GHC interactive debugger GHCi を補強する GOA package IRC上のHaskell対話bot:Lambdabot をローカルに端末の上で動かし、GHCiと対話するパッケージ GOA というものがあります。 が、GOA は cabal ではすんなりはいらないんですよね。手元にちいさなミスを修正したものを作っていたのですが、今日もらった機会に Github で公開しました。 lambdabot は導入に困らないと思うので(困るのでしたら連絡を)、lambdabot をインストールした後で、GOA も試してみてはいかがでしょうか。 % git clone git://github.com/IKEGAMIDaisuke/goa で、ソースが手に入ります。build やインストールのしかたは README をお読みください。できることの一例を下に示します:
Pointfree スタイルで書こう Pointfree スタイルという Haskell のプログラミング手法を紹介します。 このエントリは Haskell Advent Calender jp 2010 のために書かれました / その他のAdvent Calender 去年のクリスマスはとうに過ぎてしまいましたが、どうかお許しください… 具体例 : 階乗計算 正の数字 n を与えられたときに 1 * 2 * 3 * ... * n を計算する関数 fact :: Integer -> Integer を考えます。 これは階乗(factorial)と呼ばれる計算です。 n が 0 や負だったときは fact n = 1 とします。 負の階乗は、数学的には 1 ではないのですが、ここでは許してください。 模範例は次のとおり: fact :: Integer -> Integer fact n
_ 勉強会に参加する心得:ぐぐってもでてこない質問を持参して馳せ参じよ id:hanazukin さんが IT 勉強会カレンダーを作ってくださってから、勉強会が爆発的に増えたような気がする。イベント開催支援ツール ATND BETA や UStream (注:音が出ます) もそれを後押ししています。 いまから書くことは、いけがみの私見なので、読み飛ばしてもらっていいのですが、まず、「質問」を持ってきてください。もちろん、その場で聞いた話に疑問があれば、その質問をすることはいいことです。が、それとは別に、あらかじめ、講演の内容を自分なりに調べておいて質問することが大切だと考えています。勉強会までに調べる時間はあるはずです。 ぐぐればわかることを質問 ぐぐればわかることがわかる ぐぐってもわからないことを質問 勉強会に参加したことでしか得られない質問の答えを得る 分類すれば、あたりまえのことで
_ ふつうでない Haskell の学び方:なぜ「遅延する」関数型言語は重要か John Hughes の書いた "Why Functional Programming Matters" という、とても魅力的な文章があります(邦訳は nobsun がしてくださいました 『なぜ関数プログラミングは重要か』)。 この文書のなかで、 John は「遅延評価」がプログラムのモジュール化に貢献することを述べています。また、アルゴリズムを遅延的に書くことで実行効率があがることもあるということを指摘しています。 ところで、一方でこういう有名なプログラミングに関するジョーク(にしては、とても気合が入っている)をご存知の方もいることでしょう : "The Evolution of a Haskell Programmer", Fritz Ruehr, Willamette University,2001-0
いけがみを召喚するには、出現予定を参考にしてください。三週間前までにメールをくだされば、日程を追加するなどしてスケジュールに組み込むことができるかもしれません。勉強会や個人的な会合、中途採用面接などに応じます。 _ Haskell のまなびかた(2009-05-03版) わたしがはじめて Haskell の処理系を触ったのは 2004 年の春ですから、もうかれこれ 5 年の歳月がたったことになります。はやいものだなあ。当時に比べて書籍もサイトも充実してきたので、学びやすくなったとは思います。 しかし、GHC がデファクトスタンダードになりましたが、GHC の変化が著しいこと、GHC が *nix 以外のプラットフォーム(つまり Windows や MacOSX など)でバグが多いこと、ライブラリが爆発的に増えた一方でその依存性を解決する方法がまだ確立していないことなど、現在でも Haske
_ 型レベルプログラミングの会 に参加しました。感想や説明の補足、発表資料などはすべてこの日付のログにつけることにします。今週以降、時間をかけてのんびり追加する予定です。よろしくお願いします。内容の濃い話を沢山聞けたので、整理する必要があります。主催してくださったいなばさん、会場を提供してくださったサイボウズ・ラボ様、ありがとうございました。 [2009-04-28:追記]428の日にようやく下書きを清書することができました。ふいー。 _ 型レベルプログラミングの会 予告(注:2009-04-18に行われ、無事楽しく終了しました) 申し訳ありませんが、ここには SWF (Adobe Systems Flash) が置いてあります。お見せすることができなくてすみません。 ustream配信あるそうです。発表プログラムは、型レベルプログラミングの会のページをご確認下さい。 みんなも Wii の
いけがみを召喚するには、出現予定を参考にしてください。三週間前までにメールをくだされば、日程を追加するなどしてスケジュールに組み込むことができるかもしれません。勉強会や個人的な会合、中途採用面接などに応じます。 _ Prologで大阪さんの事を論理的に考える集い参加記 前日まで、Agda と型理論とモデル理論の予習をしていた。 当日になって、会場の阪急グランドビルにある「漫画しかおいていない紀伊国屋」で大阪さんの漫画4冊を購入するという泥縄ぶり。 1 巻だけ斜め読みして、大阪さんのキャラクターを把握。その後、Lambda Cube と L Cube の例の記号を暗記できんからむぐーと読み直していたら、あろはさんと合流する。 その後、時間がきたので、アジアンキッチンで 7 人。夕飯後、一階下の喫茶店に移動して 6 人でお茶。 7 人席がなく、コの字型に座ったので、真ん中の二人(ranhaさん
イネムリネズミ日記 いけがみを召喚するには、出現予定を参考にしてください。三週間前までにメールをくだされば、日程を追加するなどしてスケジュールに組み込むことができるかもしれません。勉強会や個人的な会合、中途採用面接などに応じます。 _ auto-complete.el for Haskell The auto-complete.el changes your Emacs as an integrated development environment for not only some programming languages but also Haskell. As you know, Emacs is a great editor. Recently, the auto-complete.el for editing codes as a minor mode has been de
_ 人工言語 ロジバン Lojban 解析表現文法 PEG を調べていたら、Lojban に出会った。 Lojban is a constructed, syntactically unambiguous human language based on predicate logic. (発音は EUC-JP で書けないので省略、強調は筆者による) [Lojban - Wikipedia, the free encyclopediaより引用] 形式仕様記述 formal specification はさまざまなものがあるが、どれも現場では役に立たない。机上の空論である。というのは、実際に用いられている仕様は曖昧 unambiguous で、論理 logic に基づくというよりは、むしろ自然言語に基づいているからである。 形式仕様記述を現場に投入しようと躍起になっている人々は、自然言語で書か
_ 論文ファイブが書けない言い訳(skipはご自由に) 職場でも居室でも論文は読むのだが、分量が違いすぎる。職場で読むほうが圧倒的に多いのである。一日あたりをいうと、少ないときは0本(ここは笑う場面です)、多いときはこれは例外的でちょうど70本読んだ。 70ってのはおかしすぎで、実際読んだだけで一日を終えた。これは、詳しくはいえないが、「対象についていけがみがよくわかっていない論文」の査読を依頼されたときである。しかし、著者の主張の解決策は理解できたし、私が詳細に確かめるのも悪くはないかと感じたのだった。そこで、編集者に「私、その対象については、門外漢ですが、査読にあたって最大の努力はしますよ、それで不都合があれば査読者を下ろしてください」というようなやりとりがなされたあとで、査読した(実際、差読者は複数いて、対象の専門の方も査読をなさるということだった)。 で、査読論文の1次参考文献、2
_ unsafePerformIO の使用は限定されています。ご利用は計画的に。 いたるところで、 unsafePerformIO を見かけるようになったのでひとこと言うといたるわ。「Unsafe やって書いてある」やろ。おっと、地が出てしもた。 unsafePeformIO はもともと Haskell の規格 Haskell98 にはありません。初めて現れたのは、 "The Haskell 98 Foreign Function Interface 1.0 An Addendum to the Haskell 98 Report" の 5節 Marshalling についての、5.1 節 Foreign モジュールが提供するインターフェースについてです。 unsafePerformIO :: IO a -> a Return the value resulting from execut
_ リンクつきリストにループ部分があるかどうかを確かめる リンクつきリストにループ部分があるかどうかを確かめる(ときどきの雑記帳 i戦士編 2008-11-29) 「リンクつきリストにループ部分があるかどうかを確かめる」についての言及(2008-11-29, 2008-11-30) 木の循環検知、こんな感じだとどうでしょうか。 以上の議論を興味深く読みました。まず、「木(tree)」とは連結かつサイクルを持たないグラフを指しますので、「木の循環」というのはちょっと違和感が。でも、些細なことです。さて。 データ構造を循環リストにした場合(ただし線形とは限らないので、循環リストとは呼ばないのかもしれない)、問題は非常に単純になります。つまり、最初に決めた始点=終点の間に「全体」よりも「小さなループ」があるかどうか、という問題になります。 (直感を働かせるためにも、ここにグラフの絵が必要である、
_ 黒いハンカチーフ 法川法臣アナウンサー (顔はやや焼けている。いくつかのあばたが目に最初に飛び込んでくる。穏やかな感じでペヤングカップ焼きそばの形をした中年男性。薄いフレームの眼鏡をかけ、茶の背広に青い縞のネクタイ。口を大きくあけて開く。独特なかすれのまじった低音)こんにちは。法川法臣です。六月七日今週のニュースを振り返るバラエティショウ「法川法臣と十時の奥様」の時間がやってまいりました。お昼までのひとときをご一緒にお過ごし下さい。 明日宮若子アシスタント (若く聡明な感じの女性。白く清潔な感じのする長袖のブラウスに、水色のスーツ。よく見ないと気がつかないが、小さな銀のピアスをしている)明日宮若子です。どうぞよろしく。 法川 東京はすっかり梅雨入りしましたね。 明日宮 こんな日は仕事を五時に終えて、家でシャワーとビールに限る、とおっしゃりたいんでしょ。 法川 いや、そんなことは思いませ
_ vim でも flymake (on-the-fly syntax checking) 周りに vim を使う人が多い。私も vi を使うことがあるが、それは itojun 氏の nvi-m17n を昔使っていたからである。当時(という言葉を使いたくないが)、日本語を読み書きすることのできる高機能エディタは nvi か nemacs しか無かったのである(あ、Unix の話ね。MS-DOSや国産OSのほうが当時は日本語処理がまともだった)。どちらも痛し痒しで、状況に応じて両方を使い分けるしかなかったのだ。WWW なんてなかった頃の話である。 で、今はといえば、もう断然 Emacs である。 anything.el なる便利な仕掛けができてしまったので、私はついこの間、とうとう Emacs21 から Emacs22 に乗り換えた。.emacs を移し変えるにあたって、Emacs Lisp
次のページ
このページを最初にブックマークしてみませんか?
『madscientist.jp』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く