[project @ 1996-11-26 14:46:20 by dnt]
authordnt <unknown>
Tue, 26 Nov 1996 14:46:51 +0000 (14:46 +0000)
committerdnt <unknown>
Tue, 26 Nov 1996 14:46:51 +0000 (14:46 +0000)
Merged in changes from new-build-system branch

24 files changed:
imaginary/Jmakefile [deleted file]
imaginary/Makefile [new file with mode: 0644]
imaginary/exp3_8/Jmakefile [deleted file]
imaginary/exp3_8/Makefile [new file with mode: 0644]
imaginary/exp3_8/exp3_8.stdout
imaginary/gen_regexps/Jmakefile [deleted file]
imaginary/gen_regexps/Makefile [new file with mode: 0644]
imaginary/paraffins/Jmakefile [deleted file]
imaginary/paraffins/Main.hs
imaginary/paraffins/Makefile [new file with mode: 0644]
imaginary/paraffins/paraffins.stdout
imaginary/primes/Jmakefile [deleted file]
imaginary/primes/Main.hs
imaginary/primes/Makefile [new file with mode: 0644]
imaginary/queens/Jmakefile [deleted file]
imaginary/queens/Makefile [new file with mode: 0644]
imaginary/rfib/Jmakefile [deleted file]
imaginary/rfib/Makefile [new file with mode: 0644]
imaginary/tak/Jmakefile [deleted file]
imaginary/tak/Makefile [new file with mode: 0644]
imaginary/x2n1/Jmakefile [deleted file]
imaginary/x2n1/Main.hs
imaginary/x2n1/Makefile [new file with mode: 0644]
imaginary/x2n1/x2n1.stdout

diff --git a/imaginary/Jmakefile b/imaginary/Jmakefile
deleted file mode 100644 (file)
index cd61684..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#define IHaveSubdirs
-
-SUBDIRS = exp3_8       \
-         gen_regexps   \
-         primes        \
-         queens        \
-         rfib          \
-         tak
-
-/* nfib: DIE, ANIMAL! */
diff --git a/imaginary/Makefile b/imaginary/Makefile
new file mode 100644 (file)
index 0000000..0acf1a8
--- /dev/null
@@ -0,0 +1,3 @@
+TOP = ../..
+SUBDIRS = exp3_8 gen_regexps paraffins primes queens rfib tak x2n1
+include $(TOP)/nofib/mk/nofib.mk
diff --git a/imaginary/exp3_8/Jmakefile b/imaginary/exp3_8/Jmakefile
deleted file mode 100644 (file)
index 8e2ec67..0000000
+++ /dev/null
@@ -1 +0,0 @@
-NoFibOneModuleCompileAndRun(exp3_8,)
diff --git a/imaginary/exp3_8/Makefile b/imaginary/exp3_8/Makefile
new file mode 100644 (file)
index 0000000..e018a6a
--- /dev/null
@@ -0,0 +1,3 @@
+TOP = ../../..
+PROG = exp3_8
+include $(TOP)/nofib/mk/nofib.mk
index ce80ee7..c4ab99b 100644 (file)
@@ -1 +1 @@
-6561
\ No newline at end of file
+6561
diff --git a/imaginary/gen_regexps/Jmakefile b/imaginary/gen_regexps/Jmakefile
deleted file mode 100644 (file)
index da62fb8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-NoFibOneModuleCompileAndRun(gen_regexps,-i gen_regexps.stdin)
diff --git a/imaginary/gen_regexps/Makefile b/imaginary/gen_regexps/Makefile
new file mode 100644 (file)
index 0000000..2160c80
--- /dev/null
@@ -0,0 +1,3 @@
+TOP = ../../..
+PROG = gen_regexps
+include $(TOP)/nofib/mk/nofib.mk
diff --git a/imaginary/paraffins/Jmakefile b/imaginary/paraffins/Jmakefile
deleted file mode 100644 (file)
index a78993f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-NoFibOneModuleCompileAndRun(paraffins,-i paraffins.stdin)
index 17d3acd..ee9b35e 100644 (file)
-{-  Ensnaffled by SLPJ from MIT
-    via RPaul <rpaul@juicy-juice.lcs.mit.edu> 93/08/26.
--}
+{-
+ - Id Example Program
+ - Ensnaffled by SLPJ from MIT via
+ - RPaul <rpaul@juicy-juice.lcs.mit.edu> 93/08/26.
+ - Original author: Steve Heller
+ -}
 
--- Id Example Program
--- Title: Paraffins
--- Original Author: Steve Heller
+module Main (main) where
+import Array
 
--- Needs the following library functions
--- typeof div = I -> I -> I;
--- typeof ceiling = F -> I;
--- typeof float  = I -> F;
--- typeof length = (list *0) -> I;
--- typeof odd? = I -> B;
--- typeof max = I -> I -> I;
-
-module Main where
-
--- Generation of radicals.
+-- Generation of radicals
 
 data Radical = H | C Radical Radical Radical
 
 three_partitions m =
-  [ (i,j,k) | i <- [0..(div m 3)],
-              j <- [i..(div (m-i) 2)],
-              k <- [(m - (i+j))]]
+  [ (i,j,k) | i <- [0..(div m 3)], j <- [i..(div (m-i) 2)], k <- [m - (i+j)]]
 
 remainders [] = []
 remainders (r:rs) = (r:rs) : (remainders rs)
 
-radical_generator n = radicals where 
-  { radicals = array (0,n)
-                  ((0 := [H]):
-                   [j := (rads_of_size_n radicals j) | j <- [1..n]])}
-
-
--- $[1 1 1 2 4 8 17 39 89 211 507 1238 3057 7639 19241 48865 124906 321198]
-test_radicals n = 
-  array (0,n) [i := (length (rads!i)) | rads <- [(radical_generator n)],
-                                      i    <- [0..n]]
+radical_generator n =
+  radicals
+ where 
+  radicals =
+    array (0,n) ((0,[H]) : [(j,rads_of_size_n radicals j) | j <- [1..n]])
 
 rads_of_size_n radicals n =
-  [ (C ri rj rk) | (i,j,k)  <- (three_partitions (n-1)),
-                   (ri:ris) <- (remainders (radicals!i)),
-                   (rj:rjs) <- (remainders (if (i==j) then (ri:ris) else radicals!j)),
-                   rk       <- (if (j==k) then (rj:rjs) else radicals!k)]
+  [ (C ri rj rk)
+  | (i,j,k)  <- (three_partitions (n-1)),
+    (ri:ris) <- (remainders (radicals!i)),
+    (rj:rjs) <- (remainders (if (i==j) then (ri:ris) else radicals!j)),
+    rk       <- (if (j==k) then (rj:rjs) else radicals!k)]
 
 -- Generation of paraffins.
 
 data Paraffin = BCP Radical Radical | CCP Radical Radical Radical Radical
 
 bcp_generator radicals n =
-  if (odd n) then
-    []
+  if (odd n) then []
   else
     [ (BCP r1 r2) | (r1:r1s) <- (remainders (radicals!(div n 2))),
                     r2       <- (r1:r1s) ]
     
 four_partitions m =
-  [ (i,j,k,l) | i <- [0..(div m 4)],
-                j <- [i..(div (m-i) 3)],
-                k <- [(max j (ceiling ((fromInteger m)/(fromInteger 2)) - i - j))..(div (m-i-j) 2)],
-                l <- [(m - (i+j+k))]]
+  [ (i,j,k,l)
+  | i <- [0..(div m 4)],
+    j <- [i..(div (m-i) 3)],
+    k <- [(max j (ceiling ((fromInteger m)/(fromInteger 2)) - i - j))..(div (m-i-j) 2)],
+    l <- [(m - (i+j+k))]]
 
 ccp_generator radicals n =
-  [ (CCP ri rj rk rl) | (i,j,k,l) <- (four_partitions (n-1)),
-                        (ri:ris)  <- (remainders (radicals!i)),
-                        (rj:rjs)  <- (remainders (if (i==j) then (ri:ris) else radicals!j)),
-                        (rk:rks)  <- (remainders (if (j==k) then (rj:rjs) else radicals!k)),
-                        rl        <- (if (k==l) then (rk:rks) else radicals!l)]
-
-bcp_until n = let
-  { radicals = radical_generator (div n 2)}
-  in
-    array (1,n) [j := (bcp_generator radicals j) | j <-  [1..n]]
-
-ccp_until n = let
-  { radicals = radical_generator (div n 2)}
-  in
-    array (1,n) [j := (ccp_generator radicals j) | j <- [1..n]]
-
-ccp_at n = let
-  { radicals = radical_generator (div n 2)}
-  in
-    (ccp_generator radicals n)
-
-paraffins_until n = let
-  { radicals = radical_generator (div n 2)}
-  in
-    array (1,n) [j := ((bcp_generator radicals j),(ccp_generator radicals j)) | j <- [1..n]]
-
--- $[0 1 0 1 0 3 0 10 0 36 0 153 0 780 0 4005 0]
-test_bcp_until n = let
-  { result = bcp_until n}
-  in
-
-    array (1,n) [i := (length (result!i)) | i <- [1..n]]
-
--- $[1 0 1 1 3 2 9 8 35 39 159 202 802 1078 4347 6354 24894]
-test_ccp_until n = let
-  { result = ccp_until n}
-  in
-    array (1,n) [i := (length (result!i)) | i <- [1..n]]
-    
--- $[1 1 1 2 3 5 9 18 35 75 159 355 802 1858 4347 10359 24894]
-test_paraffins_until n = let
-  { result = paraffins_until n}
-  in
-    array (1,n) [i := (let { (bv,cv) = result!i} in (length bv) + (length cv))
-                      | i <- [1..n]]
+  [ (CCP ri rj rk rl)
+  | (i,j,k,l) <- (four_partitions (n-1)),
+    (ri:ris)  <- (remainders (radicals!i)),
+    (rj:rjs)  <- (remainders (if (i==j) then (ri:ris) else radicals!j)),
+    (rk:rks)  <- (remainders (if (j==k) then (rj:rjs) else radicals!k)),
+    rl        <- (if (k==l) then (rk:rks) else radicals!l)]
+
+bcp_until n =
+  [length(bcp_generator radicals j) | j <- [1..n]]
+ where
+  radicals = radical_generator (div n 2)
+
+ccp_until n =
+  [length(ccp_generator radicals j) | j <- [1..n]]
+ where
+  radicals = radical_generator (div n 2)
+
+paraffins_until n =
+  [length (bcp_generator radicals j) + length (ccp_generator radicals j)
+   | j <- [1..n]]
+ where
+  radicals = radical_generator (div n 2)
 
 main = do
-    putStr "Type in N: "
-    input <- getContents
-    putStr (show (test_paraffins_until (read (head (lines input)))))
+  print [length (rads!i) | rads <- [(radical_generator 17)], i <- [0..17]]
+  print (bcp_until 17)
+  print (ccp_until 17)
+  print (paraffins_until 17)
diff --git a/imaginary/paraffins/Makefile b/imaginary/paraffins/Makefile
new file mode 100644 (file)
index 0000000..bbf09d5
--- /dev/null
@@ -0,0 +1,3 @@
+TOP = ../../..
+PROG = paraffins
+include $(TOP)/nofib/mk/nofib.mk
index e69de29..3a69f7c 100644 (file)
@@ -0,0 +1,4 @@
+[1, 1, 1, 2, 4, 8, 17, 39, 89, 211, 507, 1238, 3057, 7639, 19241, 48865, 124906, 321198]
+[0, 1, 0, 1, 0, 3, 0, 10, 0, 36, 0, 153, 0, 780, 0, 4005, 0]
+[1, 0, 1, 1, 3, 2, 9, 8, 35, 39, 159, 202, 802, 1078, 4347, 6354, 24894]
+[1, 1, 1, 2, 3, 5, 9, 18, 35, 75, 159, 355, 802, 1858, 4347, 10359, 24894]
diff --git a/imaginary/primes/Jmakefile b/imaginary/primes/Jmakefile
deleted file mode 100644 (file)
index 0606545..0000000
+++ /dev/null
@@ -1 +0,0 @@
-NoFibOneModuleCompileAndRun(primes,)
index d6aabc3..c4b5a56 100644 (file)
@@ -11,4 +11,3 @@ primes :: [Int]
 primes = map head (iterate the_filter (iterate suCC 2))
 
 main = print (primes !! 1500)
---OLD: main = print (take 300 primes)
diff --git a/imaginary/primes/Makefile b/imaginary/primes/Makefile
new file mode 100644 (file)
index 0000000..deff97d
--- /dev/null
@@ -0,0 +1,3 @@
+TOP = ../../..
+PROG = primes
+include $(TOP)/nofib/mk/nofib.mk
diff --git a/imaginary/queens/Jmakefile b/imaginary/queens/Jmakefile
deleted file mode 100644 (file)
index 7dcf86c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-NoFibOneModuleCompileAndRun(queens,)
diff --git a/imaginary/queens/Makefile b/imaginary/queens/Makefile
new file mode 100644 (file)
index 0000000..f3a64c4
--- /dev/null
@@ -0,0 +1,3 @@
+TOP = ../../..
+PROG = queens
+include $(TOP)/nofib/mk/nofib.mk
diff --git a/imaginary/rfib/Jmakefile b/imaginary/rfib/Jmakefile
deleted file mode 100644 (file)
index 1010e90..0000000
+++ /dev/null
@@ -1 +0,0 @@
-NoFibOneModuleCompileAndRun(rfib,)
diff --git a/imaginary/rfib/Makefile b/imaginary/rfib/Makefile
new file mode 100644 (file)
index 0000000..12c67cc
--- /dev/null
@@ -0,0 +1,3 @@
+TOP = ../../..
+PROG = rfib
+include $(TOP)/nofib/mk/nofib.mk
diff --git a/imaginary/tak/Jmakefile b/imaginary/tak/Jmakefile
deleted file mode 100644 (file)
index e06ca5d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-NoFibOneModuleCompileAndRun(tak,)
diff --git a/imaginary/tak/Makefile b/imaginary/tak/Makefile
new file mode 100644 (file)
index 0000000..cc60391
--- /dev/null
@@ -0,0 +1,3 @@
+TOP = ../../..
+PROG = tak
+include $(TOP)/nofib/mk/nofib.mk
diff --git a/imaginary/x2n1/Jmakefile b/imaginary/x2n1/Jmakefile
deleted file mode 100644 (file)
index 21765fb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-NoFibOneModuleCompileAndRun(x2n1,)
index a57da72..dc8d7e7 100644 (file)
@@ -23,7 +23,10 @@ of all the other programs I thought I'd contribute at least one :-)
 ...
 -}
 
-main = prints (round (realPart (sum [f n | n<-[1..10000]]))) "\n"
+module Main ( main ) where
+import Complex
+
+main = print (round (realPart (sum [f n | n <- [1..10000]])))
 
 f :: Int -> Complex Double
 f n = mkPolar 1 (2*pi/fromInt n) ^ n
diff --git a/imaginary/x2n1/Makefile b/imaginary/x2n1/Makefile
new file mode 100644 (file)
index 0000000..81cb883
--- /dev/null
@@ -0,0 +1,3 @@
+TOP = ../../..
+PROG = x2n1
+include $(TOP)/nofib/mk/nofib.mk
index ce80ee7..5caff40 100644 (file)
@@ -1 +1 @@
-6561
\ No newline at end of file
+10000