opening it up with Common Lisp

Favorite weblogs

Lisp Related

Bill Clementson

Finding Lisp

Lemonodor

Lispmeister.com

Planet Lisp

Politics

Orcinus

Talking Points Memo

This Modern World

Working for Change

Other home

Polliblog

Recent Readings

Book review: Darwinia
Reviewed: Friday, August 11, 2006

Summer reading: Spin
Reviewed: Saturday, August 5, 2006

Runner
Reviewed: Tuesday, July 18, 2006

the Omnivoire's Delimma
Reviewed: Wednesday, July 12, 2006

the Golem's Eye
Reviewed: Wednesday, May 31, 2006





tinderbox
 width=

I can adjust
Wednesday, March 8, 2006

Zach Beane helped to clarify my surprises with delete a bit via e-mail (thanks). One issue was my fuzzy recollection of the differences and connections between simple array, fill pointers and adjustability. Another is the issue of expressly adjustable versus actual adjustability. The hyperspec says that simple-array is:

The type of an array that is not displaced to another array, has no fill pointer, and is not expressly adjustable is a subtype of type simple-array. The concept of a simple array exists to allow the implementation to use a specialized representation and to allow the user to declare that certain values will always be simple arrays.

When you delete from a vector, the array you get back may not be expressly adjustable anymore -- you can still call adjust-array on it but this may cause a copy to occur in order to do the adjustment. (Which, in my opinion, is sort of like claiming that everyone can fly as long as you don't care how hard they hit the ground when they land...).

My issue was (and is) that I was using delete multiple times and didn't expect it to alter the actual adjustability of my vectors. This seems like a rough edge in the standard that should be improved in the Common Lisp 2007 standard.

(In case anyone is wondering why this just cropped for me it's because I'm a long time Macintosh Common Lisp user and all of MCL's arrays are adjustable. SBCL has non-expressly adjustable arrays but the vector returned when you delete from an expressly adjustable array remains adjustable. So it wasn't until I started running code in Allegro that I ran into this corner. Live and learn (and complain [smile]).


|

Home | About | Quotes | Recent | Archives

Copyright -- Gary Warren King, 2004 - 2006