3/4/5-tuple accessors

This commit is contained in:
Simon Michael 2014-03-26 11:15:04 -07:00
parent ce888a62d5
commit c5a839b309

View File

@ -215,6 +215,23 @@ fitto w h s = intercalate "\n" $ take h $ rows ++ repeat blankline
fit w = take w . (++ repeat ' ')
blankline = replicate w ' '
-- tuples
first3 (x,_,_) = x
second3 (_,x,_) = x
third3 (_,_,x) = x
first4 (x,_,_,_) = x
second4 (_,x,_,_) = x
third4 (_,_,x,_) = x
fourth4 (_,_,_,x) = x
first5 (x,_,_,_,_) = x
second5 (_,x,_,_,_) = x
third5 (_,_,x,_,_) = x
fourth5 (_,_,_,x,_) = x
fifth5 (_,_,_,_,x) = x
-- math
difforzero :: (Num a, Ord a) => a -> a -> a