summaryrefslogtreecommitdiff
path: root/ipl/progs/delta.icn
diff options
context:
space:
mode:
Diffstat (limited to 'ipl/progs/delta.icn')
-rw-r--r--ipl/progs/delta.icn32
1 files changed, 32 insertions, 0 deletions
diff --git a/ipl/progs/delta.icn b/ipl/progs/delta.icn
new file mode 100644
index 0000000..f65dcc9
--- /dev/null
+++ b/ipl/progs/delta.icn
@@ -0,0 +1,32 @@
+############################################################################
+#
+# File: delta.icn
+#
+# Subject: Program to list differences between successive numbers
+#
+# Author: Ralph E. Griswold
+#
+# Date: January 22, 1999
+#
+############################################################################
+#
+# This file is in the public domain.
+#
+############################################################################
+#
+# This program reads a stream of numbers from standard input and write
+# a stream of their first differences to standard output.
+#
+############################################################################
+
+procedure main()
+ local i, j
+
+ i := read() | exit()
+
+ while j := read() do {
+ write(j - i)
+ i := j
+ }
+
+end