--As off Wednesday, January 14, 2004 11:24 PM -0500, Daniel Staal is
alleged to have said:
my @a = unpack("C*", $a);
my @b = unpack("C*", $b);
This can also be done with a:
my @a = split //, $a; # (That is a null pattern.)
I'm not sure if split or unpack is faster, I'll have to benchma
Daniel Staal wrote:
>
> > Oh no! Its slower! I wrote a function implementing what is
> > described above and its actually slower (about 1/2 as slow) than
> > that huge thing I posted earlier. Does anything stand out here as
> > being inefficient? Here it is:
>
> (First glance stuff:)
>
> > sub comp
Danl001 wrote:
>
> I do not have access to the sort operation. All I have is a file that is
> "sorted" but I don't know exactly the mechanism by which it was sorted.
> What I am trying to do is write a comparison function--given any two
> lines in this file, return -1, 0, 1 as perl's cmp function d
--As off Wednesday, January 14, 2004 10:48 PM -0500, Dan is alleged
to have said:
Oh no! Its slower! I wrote a function implementing what is
described above and its actually slower (about 1/2 as slow) than
that huge thing I posted earlier. Does anything stand out here as
being inefficient? Here i
danl001 wrote:
Here, the first 10 characters correspond but then the second string runs
out. Using our rule, we'd order ABC-MARKET before ABC-MARKET.ABC-MARKET,
which is wrong. I guess I could try following that rule, but if the
character position in the longer string that corresponds to the fi
Daniel Staal wrote:
Quick question: is this data more representative than the data in the
first email? In particular, does set 4 from the first email actually
exist, exactly as listed, anywhere?
If this latter data is more representative I'd bet on ASCIIbetical
ordering: Compare each string on
--As off Wednesday, January 14, 2004 6:23 PM -0500, danl001 is
alleged to have said:
I'm thinking the way the file is sorted is something simple, yet
something I don't recgonize! As a result, you'll see that my method
is probably very over-complicated.
I have also posted some more data that is re
Hello,
I do not have access to the sort operation. All I have is a file that is
"sorted" but I don't know exactly the mechanism by which it was sorted.
What I am trying to do is write a comparison function--given any two
lines in this file, return -1, 0, 1 as perl's cmp function does. I don't
Dan Laflamme wrote:
>
> I have a file that appears to be somewhat sorted, but is not sorted
> according to the traditional unix sort. I'll give some examples, and if
> anyone recgonizes the way in which the file is sorted, please let me
> know. Also, since I may have to write a comparator function
g on ASCII comparison',$/,$/;
for(sort keys %$sets) {
print ' ',$_,$/;
# ASCII sort (same as sort { $a cmp $b })
for(sort @{$sets->{$_}}) { print '',$_,$/; }
print $/;
}
exit;
Shawn
-Original Message-
From: Dan LaFlamme [mailto:[EMAIL PROTECTED]
Sent:
Hi,
I have a file that appears to be somewhat sorted, but is not sorted
according to the traditional unix sort. I'll give some examples, and if
anyone recgonizes the way in which the file is sorted, please let me
know. Also, since I may have to write a comparator function for use on
this "sort
11 matches
Mail list logo