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

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



-- ==========================================================--
-- === Monster -- Enumerates the points in a lattice.     ===--
-- === Not part of the strictness analyser proper.        ===--
-- ===                                         Monster.hs ===--
-- ==========================================================--

module Main where

import BaseDefs
import MyUtils
import Utils
import AbstractVals2
import SuccsAndPreds2
import AbstractMisc

pretty x
  = f 0 0 x
    where
       f n h [] = "\n\nDone: " ++ show n ++ " total points, " ++ show h
                  ++ " height.\n"
       f n h (x:xs)
          = "\n  " ++ show (h+1) ++ " contains " ++ show x
             ++ f (n+x) (h+1) xs

main
   = putStr banner	>>
     getContents	>>= \ inText ->
     let
         d = first (head (reads inText))
     in
     mySeq d (putStr ("\n\n" ++ pretty (map length (amAllUpSlices d))))
   where 
         banner = concat 
                   [ "\nMonster 0.400r: generates all points in a domain.\n",
                     "Copyright (c) Julian Seward 1992",
                     "\n\nEnter the domain: " ]


-- ==========================================================--
-- === end                                     Monster.hs ===--
-- ==========================================================--

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.