Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/tests/nofib/real/fem/Basics.hs

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


-- Glasgow Haskell 0.403 : FINITE ELEMENT PROGRAM
-- **********************************************************************
-- *                                                                    *
-- * FILE NAME : basics.hs 		DATE : 4-3-1991                 *
-- *                                                                    *
-- * CONTENTS : Basics functions for output.                            *
-- *                                                                    *
-- **********************************************************************


module Basics(showrj,showlj, azip, module Array) where

import Array


showlj, showrj :: (Show a) => Int -> a -> [Char]

rep :: Int -> a -> [a]

rep 0 x = []
rep n x = x : (rep (n-1) x)

showrj l x
      = (rep bs ' ') ++ ns
        where
        ns = dropWhile ((==) ' ') (show x)
        bs | l <= length ns   = 1
           | otherwise        = l - length ns

showlj l x
      = ns ++ (rep bs ' ')
        where
        ns = dropWhile ((==) ' ') (show x)
        bs | l <= length ns   = 1
           | otherwise        = l - length ns

azip :: [a] -> [b] -> [(a,b)]

azip [] [] = []
azip ( x : ls ) ( x' : ls' ) = (x,x') : (azip ls ls')



Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].