2004-12-11から1日間の記事一覧

Infix trick

メモ。Haskell-Cafeより。 infixr 0 -:, :- data Infix f y = f :- y x -:f:- y = x `f` y main = print $ [1,2,3] -: zipWith (+) :- [4,5,6]http://www.haskell.org/pipermail/haskell-cafe/2002-July/003215.html

引数の数の自動判定

お題: 関数引数のpermutationの蛇足。 *TestFunArgPerm> [f 1 2 3 | f <- permArgs' (\a b c -> [a, b, c])] [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]{-# OPTIONS -fglasgow-exts -fallow-undecidable-instances #-} {-# OPTIONS -fallow-overlap…