http://projecteuler.net/index.php?section=problems&id=102

三角形の内部判定。

外積を使うと楽。かな。

import Data.List
cross (x,y) (u,v) = x*v-y*u
containO [x,y,z] = sameSign.map (uncurry cross)$[(x,y),(y,z),(z,x)]
where sameSign xs = all (>) xs || all (<) xs
toTuples = unfoldr t
where t [] = Nothing
t (x:y:zs) = Just ((x,y),zs)
main = do f <-readFile $ "triangles.txt"
print.length.filter (containO.triangle).lines$f
where triangle x = toTuples.read$"["++ x ++ "]" ::[(Int,Int)]