Re: MARC::Record ordering of fields

2005-05-14 Thread Brad Baxter
On Sat, 14 May 2005, Bruce Van Allen wrote: > If you haven't seen it, you might be interested in the "packed-default" > sort described by Uri Guttman and Larry Rosler, and now usually refered > to as the Guttman-Rosler sort. For their original paper, see: >

Re: MARC::Record ordering of fields

2005-05-14 Thread Bruce Van Allen
On 5/14/05 Leif Andersson wrote: >It is funny, I started with a Schwartzian transform, but thought to >myself "why not simplify the code?". Not realizing it is a performance >gain. I have always thought of it only as a means to do more >complicated sorts. >... >Funny, once more, is that one member

Re: MARC::Record ordering of fields

2005-05-14 Thread Leif Andersson
lc($_->{_tag})] } @{$record->{_fields}}; If field "500" had not been assigned a sort key, we would see that field erroneously sort before any other 5XX field. To prevent that we could add a definition for 500 as the last one i.e. "500" => "500"

Re: MARC::Record ordering of fields

2005-05-13 Thread Brad Baxter
On Fri, 13 May 2005, Leif Andersson wrote: > How would you do to re-order the fields in a MARC::Record-record? > > I just needed that kind of thing and after some struggeling came up with: > > @{$record->{_fields}} = > sort { > lc($a->{_tag}) cmp lc($b->{_tag}) >} >

MARC::Record ordering of fields

2005-05-13 Thread Leif Andersson
How would you do to re-order the fields in a MARC::Record-record? I just needed that kind of thing and after some struggeling came up with: @{$record->{_fields}} = sort { lc($a->{_tag}) cmp lc($b->{_tag}) } @{$record->{_fields}}; It seems to work, but I am in