1 
    2 
    3 
    4 
    5 
    6 
    7 
    8 
    9 
   10 
   11 module Misc where
   12 
   13 takeuntil :: (a ->Bool) -> [a] -> [a]
   14 
   15     {- A variant of takewhile and dropwhile. -}
   16 
   17 
   18 takeuntil p [] = []
   19 takeuntil p (x:xs) 
   20                   | p x = [x]
   21                   | otherwise  = x:(takeuntil p xs)
   22 
   23 
   24 inrange :: Int -> Int -> Int -> Bool
   25 inrange low high x = (low<=x)&&(x<=high)
   26 
   27 forceVec :: [Float] -> [Float]
   28 forceVec v = 
   29     case (f v) of
   30     True -> v
   31     where
   32     f [] = True
   33     f (x:xs) = case (forceFloat x) of
   34                 True -> case (f xs) of
   35                          True -> True
   36 
   37 forceInt :: Int -> Bool
   38 forceInt 0 = True
   39 forceInt x = True
   40 
   41 forceFloat :: Float -> Bool
   42 forceFloat 0 = True
   43 forceFloat x = True
   44 
   45 forceMat :: [[Float]] -> [[Float]]
   46 forceMat m = map forceVec m
   47 
   48 
   49 
   50 
   51 
   52 
   53 
   54 
   55 
   56 
   57 
   58 
   59 
   60 
   61 
   62 
   63 
   64 
   65 
   66 
   67 
   68 
   69 type Runitem = ([Char],[Char])
   70 
   71 mkrunitem :: [Char] -> [Char] -> Runitem
   72 mkrunitem output label = (output,label)
   73 
   74 run :: Runitem -> [Char]
   75 run (output,label)
   76    = "START" ++ output ++ "\n" ++ "END"
   77     
   78 
   79 
   80