2009-06-15から1日間の記事一覧

三角形の内外判定(2D)

C++

id:melponからもらったコードをメモ。 http://codepad.org/Nd0zKyFy struct point { point() : x(0), y(0) { } point(double x_, double y_) : x(x_), y(y_) { } double x, y; }; point operator-(const point& a, const point& b) { return point(a.x - b.x…

型の別名

Haskellでは、typeキーワードで型の別名を定義します。 type Point = (Integer, Integer) foo :: Point -> String foo p = show p foo (0, 1) → "(0, 1)"