[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why vectors?
- To: srfi-99@xxxxxxxxxxxxxxxxx
- Subject: Re: Why vectors?
- From: Derick Eddington <derick.eddington@xxxxxxxxx>
- Date: Mon, 11 Aug 2008 14:52:45 -0700
- Delivered-to: srfi-99@xxxxxxxxxxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:in-reply-to :references:content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=J6h9wjXYya86lf9f6lxQcFdGJsuV6g0DkZzUAmdN/Ww=; b=jbPv6MEcNKFol07GV39a/8tIcb3jZnarw0SoirAUMBLrUQcPGfgdJjmXHXQr02PP6m K4bcrywX3505zGwHQ8MMQRS2IyWLNrgjQZtgf1AGcRXsNbaIDnM7jvgiQ2KXIVk22rs6 cvow0y+6/HCY6WqsflzwxzL7T/F/ywKPQG6bE=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:in-reply-to:references:content-type:date:message-id :mime-version:x-mailer:content-transfer-encoding; b=NHHveJPl/iSxRNdZEI0dRVHPmkzCq0Amn55irAtN9dcRyA9zWcglCbmT/TD40upVi0 y1Rc6ampYd1L3878FhDrneyOyaBmhbjIaUea2dge3gJfXXpjTmB//YbcLUMeKPNWTO2s KNXJur4QZyAlZEaV5Gmtx17BA63Nn+NFnyGjQ=
- In-reply-to: <Pine.LNX.4.61.0808110032000.17650@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- References: <1218433189.7249.107.camel@eep> <Pine.LNX.4.61.0808110032000.17650@xxxxxxxxxxxxxxxxxxxxxxxxxx>
On Mon, 2008-08-11 at 00:38 -0700, Elf wrote:
> On Sun, 10 Aug 2008, Derick Eddington wrote:
>
> > Why are vectors and not lists used for make-rtd's and rtd-constructor's
> > fieldspecs arguments and for rtd-field-names's and rtd-all-field-names's
> > return values? Is the only reason to follow R6RS's use of vectors? If
> > so, I request lists be used instead because they're easier to deal with,
> > as shown by how much list<->vector conversion is done in the ERR5RS
> > reference implementation itself. Using lists instead would increase the
> > appeal of this SRFI to me, and I think to others also. IMO,
> > interoperating with the R6RS records procedures that deal in vectors
> > without having to convert list<->vector is not a good enough reason
> > compared to the benefit of using lists with one's primary record system
> > of use, because interoperating at the procedural level where these
> > vectors matter will be rare (I imagine). Or is there a good reason to
> > use vectors?
>
> Vector referencing is in constant time. List referencing is in linear time.
> Vector mutation is in constant time. List mutation is in linear time.
>
> As records are essentially vectors (constant sized, fixed order, etc) with
> procedures mapping to indices, using lists would be a significant performance
> cost for no benefit: one generally doesn't iterate over the elements of a
> record. Record types are for grouping related *but independently used* data
> together.
I'm suggesting lists be considered for make-rtd's and rtd-constructor's
fieldspecs arguments and for rtd-field-names' and rtd-all-field-names'
return values not to assist iterating over the elements of a record but
to assist iterating over, searching, composing, and manipulating the
API's field specifiers.
--
: Derick
----------------------------------------------------------------