home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / function / 1487 < prev    next >
Encoding:
Internet Message Format  |  1993-01-06  |  962 b 

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!linac!att!att!allegra!alice!ark
  2. From: ark@alice.att.com (Andrew Koenig)
  3. Newsgroups: comp.lang.functional
  4. Subject: Re: Length of Arrays in SML
  5. Message-ID: <24561@alice.att.com>
  6. Date: 6 Jan 93 09:28:50 GMT
  7. Article-I.D.: alice.24561
  8. References: <C0ECE1.Ju@cs.dal.ca>
  9. Reply-To: ark@alice.UUCP ()
  10. Organization: AT&T Bell Laboratories, Murray Hill NJ
  11. Lines: 16
  12.  
  13. In article <C0ECE1.Ju@cs.dal.ca> ssmith@ug.cs.dal.ca (Susan E Smith) writes:
  14.  
  15. > PROBLEM:  I am using Standard ML (New Jersey), Version 0.66 and I am trying
  16. > to use the Array function "length" to get the length of an array.
  17.  
  18. The problem is that the built-in function "length" takes a list,
  19. as you found out.  What you want is the "length" in the Array
  20. structure, which is therefore called Array.length:
  21.  
  22.     val My_Array = arrayoflist ["Hi","My","Name","Is","Bob"];
  23.     Array.length My_Array;
  24.  
  25. should print 5.
  26. -- 
  27.                 --Andrew Koenig
  28.                   ark@europa.att.com
  29.