home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / BIPL.ZIP / PROCS.ZIP / IDENTITY.ICN < prev    next >
Encoding:
Text File  |  1992-09-28  |  731 b   |  32 lines

  1. ############################################################################
  2. #
  3. #    File:     identity.icn
  4. #
  5. #    Subject:  Procedures to 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.