home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / function / 1484 next >
Encoding:
Text File  |  1993-01-05  |  1.6 KB  |  41 lines

  1. Newsgroups: comp.lang.functional
  2. Path: sparky!uunet!newsflash.concordia.ca!nstn.ns.ca!cs.dal.ca!ug.cs.dal.ca!ssmith
  3. From: ssmith@ug.cs.dal.ca (Susan E Smith)
  4. Subject: Length of Arrays in SML
  5. Message-ID: <C0ECE1.Ju@cs.dal.ca>
  6. Sender: usenet@cs.dal.ca (USENET News)
  7. Nntp-Posting-Host: ug2.cs.dal.ca
  8. Organization: Math, Stats & CS, Dalhousie University, Halifax, NS, Canada
  9. Date: Tue, 5 Jan 1993 19:49:12 GMT
  10. Lines: 29
  11.  
  12. PROBLEM:  I am using Standard ML (New Jersey), Version 0.66 and I am trying
  13. to use the Array function "length" to get the length of an array.  I have
  14. defined my array using arrayoflist:
  15.  
  16.     eg.    val My_Array = arrayoflist ["Hi","My","Name","Is","Bob"];
  17.  
  18.     Now I want to use "length My_Array" to return the integer 5.
  19.  
  20. The reference manual I am using, says that this can be done and that the
  21. function length is one that takes an array and returns an int.
  22.  
  23. However, this gives me an error when I try it in my version of SML and when
  24. I type "length;" it tells me that length accepts a list and returns an int,
  25.  
  26.     eg.    length My_List;  returns the length of the list, My_List.
  27.  
  28.     I have tested this and this is the case.
  29.  
  30. The discrepancy between my reference manual and my version of SML is not the
  31. major concern here, what I really want to know is:  Is there a way to get
  32. the length of an array in the version of SML I am using.  This is important
  33. to my application because I have a statement that says My_Array sub i where
  34. i is begin incremented; hence, once i is out of range for the array, I don't
  35. want the function to continue executing.
  36.  
  37. Any help would be greatly appreciated.
  38.  
  39. Susan
  40. ssmith@ug.cs.dal.ca
  41.