home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / OL.LZH / PROCS.LZH / IDENTITY.ICN < prev    next >
Text File  |  1991-09-05  |  705b  |  32 lines

  1. ############################################################################
  2. #
  3. #    Name:    identity.icn
  4. #
  5. #    Title:    Produce identities for Icon types
  6. #
  7. #    Author:    Ralph E. Griswold
  8. #
  9. #    Date:    September 2, 1991
  10. #
  11. ############################################################################
  12. #
  13. #  This procedure produces an "identity" value for types that have one.
  14. #
  15. ############################################################################
  16.  
  17. procedure identity(x)
  18.  
  19.    return case x of {
  20.       "null":  &null
  21.       "integer":  0
  22.       "real":  0.0
  23.       "string":  ""
  24.       "cset":  ''
  25.       "list":  []
  26.       "set":  set()
  27.       "table":  table()
  28.       default: fail
  29.       }
  30.  
  31. end
  32.