home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / lisp / mcl / 1271 < prev    next >
Encoding:
Text File  |  1992-08-19  |  2.1 KB  |  73 lines

  1. Path: sparky!uunet!icd.ab.com!usenet.ins.cwru.edu!agate!ames!data.nas.nasa.gov!taligent!apple!cambridge.apple.com!ueda@shpcsl.sharp.co.jp
  2. From: ueda@shpcsl.sharp.co.jp (UEDA masaya)
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: simple vector
  5. Message-ID: <9208191110.AA03726@area.shpcsl.sharp.co.jp>
  6. Date: 19 Aug 92 11:10:15 GMT
  7. Sender: info-mcl-request@cambridge.apple.com
  8. Lines: 60
  9. Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
  10. Return-Path: <ueda@shpcsl.sharp.co.jp>
  11. Original-To: info-mcl%cambridge.apple.com@kddlab.kddlabs.co.jp
  12.  
  13. Dear MCLers:
  14.  
  15. I got confused about simple vector.
  16.  
  17. I'm using MCL 2.0 final. I can make a simple vector of which
  18. :element-type is 'integer and can refer it's elements by svref.
  19.  
  20. --------------------
  21. ? (setq foo (make-array 10 :element-type 'integer :initial-element 0
  22.                         :adjustable nil :fill-pointer nil :displaced-to nil))
  23. #(0 0 0 0 0 0 0 0 0 0)
  24. ? (svref foo 0)
  25. 0
  26. ?
  27. --------------------
  28.  
  29. But when I make a vector of which :element-type is fixnum, referrence
  30. by svref causes an error as follows.
  31.  
  32. --------------------
  33. ? (setq bar (make-array 10 :element-type 'fixnum :initial-element 0
  34.                         :adjustable nil :fill-pointer nil :displaced-to nil))
  35. #(0 0 0 0 0 0 0 0 0 0)
  36. ? (svref bar 0)
  37. > Error: value #<VECTOR 10 type (SIGNED-BYTE 32), simple> is not of the expected type SIMPLE-VECTOR.
  38. > While executing: CCL::TOPLEVEL-EVAL
  39. > Type Command-. to abort.
  40. See the RestartsI menu item for further choices.
  41. 1 > 
  42. Aborted
  43. ?
  44. --------------------
  45.  
  46. Why make-array returns simple vector when :element-type is 'integer
  47. and dose not return simple vector when :element-type is 'fixnum? I
  48. feel it queer because fixnum is a subtype of integer, but Sun4 Allegro
  49. Common Lisp causes same error...
  50.  
  51. And MCL says me that bar is array and vector and simple-array, but not
  52. simple-vecotor.
  53.  
  54. --------------------
  55. ? (typep bar 'array)
  56. T
  57. ? (typep bar 'vector)
  58. T
  59. ? (typep bar 'simple-array)
  60. T
  61. ? (typep bar 'simple-vector)
  62. NIL
  63. ?
  64. --------------------
  65.  
  66. I referred CLtL2 but I can not understand these results well. Any
  67. suggestions are welcome.
  68.  
  69. --- Thanks ---
  70. Masaya UEDA
  71. Information System R&D Center, SHARP Co.
  72. 2613-1 Ichinomoto, Tenri, Nara 632, JAPAN
  73.