[project @ 1996-07-25 21:02:03 by partain]
[nofib.git] / real / fem / Basics.hs
1 -- Glasgow Haskell 0.403 : FINITE ELEMENT PROGRAM
2 -- **********************************************************************
3 -- * *
4 -- * FILE NAME : basics.hs DATE : 4-3-1991 *
5 -- * *
6 -- * CONTENTS : Basics functions for output. *
7 -- * *
8 -- **********************************************************************
9
10
11 module Basics(showrj,showlj, azip) where
12
13
14 showlj, showrj :: (Show a) => Int -> a -> [Char]
15
16 rep :: Int -> a -> [a]
17
18 rep 0 x = []
19 rep n x = x : (rep (n-1) x)
20
21 showrj l x
22 = (rep bs ' ') ++ ns
23 where
24 ns = dropWhile ((==) ' ') (show x)
25 bs | l <= length ns = 1
26 | otherwise = l - length ns
27
28 showlj l x
29 = ns ++ (rep bs ' ')
30 where
31 ns = dropWhile ((==) ' ') (show x)
32 bs | l <= length ns = 1
33 | otherwise = l - length ns
34
35 azip :: [a] -> [b] -> [Assoc a b]
36
37 azip [] [] = []
38 azip ( x : ls ) ( x' : ls' ) = (x := x') : (azip ls ls')
39
40