summaryrefslogtreecommitdiff
path: root/miralib/ex/powers.m
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2022-03-04 12:32:20 -0500
committerJakob Kaivo <jkk@ung.org>2022-03-04 12:32:20 -0500
commit55f277e77428d7423ae906a8e1f1324d35b07a7d (patch)
tree5c1c04703dff89c46b349025d2d3ec88ea9b3819 /miralib/ex/powers.m
import Miranda 2.066 from upstream
Diffstat (limited to 'miralib/ex/powers.m')
-rw-r--r--miralib/ex/powers.m15
1 files changed, 15 insertions, 0 deletions
diff --git a/miralib/ex/powers.m b/miralib/ex/powers.m
new file mode 100644
index 0000000..019a139
--- /dev/null
+++ b/miralib/ex/powers.m
@@ -0,0 +1,15 @@
+||prints a table of powers 2 to 5 of the numbers 1 to 20
+||to see the table, say
+|| output
+
+output = title ++ captions ++ concat (map line [1..20])
+
+title = cjustify 60 "A TABLE OF POWERS" ++ "\n\n"
+
+captions = format "N" ++ concat (map caption [2..5]) ++ "\n"
+
+caption i = format ("N^" ++ shownum i)
+
+format = rjustify 12
+
+line n = concat [format (show(n^i)) | i<-[1..5]] ++ "\n"