summaryrefslogtreecommitdiff
path: root/ipl/progs/sample.icn
diff options
context:
space:
mode:
Diffstat (limited to 'ipl/progs/sample.icn')
-rw-r--r--ipl/progs/sample.icn30
1 files changed, 30 insertions, 0 deletions
diff --git a/ipl/progs/sample.icn b/ipl/progs/sample.icn
new file mode 100644
index 0000000..16b283a
--- /dev/null
+++ b/ipl/progs/sample.icn
@@ -0,0 +1,30 @@
+############################################################################
+#
+# File: sample.icn
+#
+# Subject: Program to "sample" input stream
+#
+# Author: Ralph E. Griswold
+#
+# Date: January 21, 1999
+#
+############################################################################
+#
+# This file is in the public domain.
+#
+############################################################################
+#
+# This program filters the input stream, producing every ith
+# value, starting at 1. i is given as a command-line argument; default 0.
+#
+############################################################################
+
+procedure main(args)
+ local line, skip
+
+ skip := integer(args[1]) | 0
+
+ while write(read()) do
+ every 1 to skip do read()
+
+end