summaryrefslogtreecommitdiff
path: root/ipl/procs/identity.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/procs/identity.icn
downloadicon-6ab0c0f5bf14ed9c15370407b9ee7e0b4b089ae1.tar.gz
Initial upstream version 9.4.3upstream/9.4.3
Diffstat (limited to 'ipl/procs/identity.icn')
-rw-r--r--ipl/procs/identity.icn35
1 files changed, 35 insertions, 0 deletions
diff --git a/ipl/procs/identity.icn b/ipl/procs/identity.icn
new file mode 100644
index 0000000..8bf82c0
--- /dev/null
+++ b/ipl/procs/identity.icn
@@ -0,0 +1,35 @@
+############################################################################
+#
+# File: identity.icn
+#
+# Subject: Procedures to produce identities for Icon types
+#
+# Author: Ralph E. Griswold
+#
+# Date: September 2, 1991
+#
+############################################################################
+#
+# This file is in the public domain.
+#
+############################################################################
+#
+# This procedure produces an "identity" value for types that have one.
+#
+############################################################################
+
+procedure identity(x)
+
+ return case x of {
+ "null": &null
+ "integer": 0
+ "real": 0.0
+ "string": ""
+ "cset": ''
+ "list": []
+ "set": set()
+ "table": table()
+ default: fail
+ }
+
+end