home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.lisp.mcl
- Path: sparky!uunet!cs.utexas.edu!sdd.hp.com!mips!darwin.sura.net!Sirius.dfn.de!math.fu-berlin.de!fauern!dec16!NewsWatcher!user
- From: poeck@informatik.uni-wuerzburg.de (karsten poeck)
- Subject: Re: simple vector
- Message-ID: <poeck-210892143155@132.187.103.165>
- Followup-To: comp.lang.lisp.mcl
- Sender: news@informatik.uni-wuerzburg.de (USENET News account)
- Organization: university of wuerzburg
- References: <9208191110.AA03726@area.shpcsl.sharp.co.jp>
- Date: Fri, 21 Aug 1992 12:32:36 GMT
- Lines: 83
-
- In article <9208191110.AA03726@area.shpcsl.sharp.co.jp>,
- ueda@shpcsl.sharp.co.jp (UEDA masaya) wrote:
- >
- > 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
-
- I am also quite surprised by the array construction routines
-
- For example
-
-
- (time
- (type-of (make-array 200 :element-type '(unsigned-byte *))))
- --> (SIMPLE-VECTOR 200), 1320 bytes of memory allocated
-
- and
-
- (time
- (type-of (make-array 200 :element-type '(unsigned-byte 8))))
-
- (TYPE-OF (MAKE-ARRAY 200 :ELEMENT-TYPE '(UNSIGNED-BYTE 8)))
-
- --> (SIMPLE-ARRAY (UNSIGNED-BYTE 8) (200)); 240 bytes of memory allocated
-
- Karsten Poeck
-