summaryrefslogtreecommitdiff
path: root/ipl/procs/identity.icn
diff options
context:
space:
mode:
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