summaryrefslogtreecommitdiff
path: root/ipl/progs/delta.icn
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2013-01-27 23:51:56 +0000
committerIgor Pashev <pashev.igor@gmail.com>2013-01-27 23:51:56 +0000
commit6ab0c0f5bf14ed9c15370407b9ee7e0b4b089ae1 (patch)
tree926065cf45450116098db664e3c61dced9e1f21a /ipl/progs/delta.icn
downloadicon-6ab0c0f5bf14ed9c15370407b9ee7e0b4b089ae1.tar.gz
Initial upstream version 9.4.3upstream/9.4.3
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