home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / program / language / gofer / Sources / original / gs / apr6 < prev    next >
Encoding:
Text File  |  1993-02-12  |  318 b   |  11 lines

  1. main     = appendChan stdout (answer 3) exit done
  2.  
  3. answer n = unlines (map (concat . map (pad 8 . show) . worker) bs)
  4.            where bs = [ (x,y) | x<-xs, y<-xs ]
  5.                  xs = [-n .. -1] ++ [1..n]
  6.  
  7. worker (n,m) = [ n, m, n`div`m, n`mod`m, n`quot`m, n`rem`m ]
  8.  
  9. pad n s  = iterate (' ':) s !! (n - length s)
  10.  
  11.