summaryrefslogtreecommitdiff
path: root/ipl/procs/identity.icn
blob: 8bf82c0b656195cebdc7560a6dcd8dfb05850811 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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