home *** CD-ROM | disk | FTP | other *** search
- 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
- From: ueda@shpcsl.sharp.co.jp (UEDA masaya)
- Newsgroups: comp.lang.lisp.mcl
- Subject: simple vector
- Message-ID: <9208191110.AA03726@area.shpcsl.sharp.co.jp>
- Date: 19 Aug 92 11:10:15 GMT
- Sender: info-mcl-request@cambridge.apple.com
- Lines: 60
- Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
- Return-Path: <ueda@shpcsl.sharp.co.jp>
- Original-To: info-mcl%cambridge.apple.com@kddlab.kddlabs.co.jp
-
- Dear MCLers:
-
- I got confused about simple vector.
-
- I'm using MCL 2.0 final. I can make a simple vector of which
- :element-type is 'integer and can refer it's elements by svref.
-
- --------------------
- ? (setq foo (make-array 10 :element-type 'integer :initial-element 0
- :adjustable nil :fill-pointer nil :displaced-to nil))
- #(0 0 0 0 0 0 0 0 0 0)
- ? (svref foo 0)
- 0
- ?
- --------------------
-
- But when I make a vector of which :element-type is fixnum, referrence
- by svref causes an error as follows.
-
- --------------------
- ? (setq bar (make-array 10 :element-type 'fixnum :initial-element 0
- :adjustable nil :fill-pointer nil :displaced-to nil))
- #(0 0 0 0 0 0 0 0 0 0)
- ? (svref bar 0)
- > Error: value #<VECTOR 10 type (SIGNED-BYTE 32), simple> is not of the expected type SIMPLE-VECTOR.
- > While executing: CCL::TOPLEVEL-EVAL
- > Type Command-. to abort.
- See the RestartsI menu item for further choices.
- 1 >
- Aborted
- ?
- --------------------
-
- Why make-array returns simple vector when :element-type is 'integer
- and dose not return simple vector when :element-type is 'fixnum? I
- feel it queer because fixnum is a subtype of integer, but Sun4 Allegro
- Common Lisp causes same error...
-
- And MCL says me that bar is array and vector and simple-array, but not
- simple-vecotor.
-
- --------------------
- ? (typep bar 'array)
- T
- ? (typep bar 'vector)
- T
- ? (typep bar 'simple-array)
- T
- ? (typep bar 'simple-vector)
- NIL
- ?
- --------------------
-
- I referred CLtL2 but I can not understand these results well. Any
- suggestions are welcome.
-
- --- Thanks ---
- Masaya UEDA
- Information System R&D Center, SHARP Co.
- 2613-1 Ichinomoto, Tenri, Nara 632, JAPAN
-