SoccerFun-0.1: Haskell port of a football simulation framework for teaching functional programming

SoccerFun.Prelude

Description

Collection of functions of more general purpose.

Synopsis

Documentation

avg :: Fractional a => [a] -> aSource

zero :: Num a => aSource

one :: Num a => aSource

iterateStn :: Int -> (s -> (a, s)) -> s -> ([a], s)Source

singleOutElems :: [a] -> [(a, [a])]Source

spanfilter :: (a -> Bool) -> [a] -> ([a], [a])Source

spanfilter cond xs = (filter cond xs, filter (not . cond) xs)

spanfilterSt :: (a -> s -> (Bool, s)) -> [a] -> s -> (([a], [a]), s)Source

break' :: (a -> Bool) -> [a] -> ([a], [a], [a])Source

break cond (A ++ B ++ C) = (A,B,C) where for each x in A: not cond x /\ for each x in B: cond x /\ if C=(x:_): not cond x

break1 :: (a -> Bool) -> [a] -> ([a], a, [a])Source

break1 cond (A ++ [B] ++ C) = (A,B,C) where for each x in A: not cond x /\ cond B /\ if C=(x:_): not cond x

unbreak :: ([a], [a], [a]) -> [a]Source

unbreak (a,b,c) = a ++ b ++ c

unbreak1 :: ([a], a, [a]) -> [a]Source

unbreak1 (a,b,c) = a ++ [b] ++ c

type AssocList k v = [(k, v)]Source

boundedBy :: Ord a => a -> (a, a) -> aSource

isbetween :: Ord a => a -> a -> a -> BoolSource

isbetween x low up returns True iff low <= x <= up

minmax :: Ord a => (a, a) -> (a, a)Source

minmax (a,b) = (a,b) if a<=b; (b,a) otherwise

perhaps :: (a -> Bool) -> Maybe a -> BoolSource

perhaps p Nothing = False, and perhaps p (Just a) = p a

removeMember :: Eq a => a -> [a] -> [a]Source

removeMembers :: Eq a => [a] -> [a] -> [a]Source