i have to put my 2 cents in...
after reading all the discussion so far about the Schwartz,
i feel that map{} sort map{} is perfect in it's syntax.
if you code and understand Perl (i've seen situations where
these aren't always both happening at the time) and knowingly
use the building block functions, sort and map, to create an
abstraction like the Schwartzian transform, then why do you
need to come up with special syntax or use a Sort::Module, as
it was suggested, to achieve just the same thing. my point
is that i wonder if it's useful for Perl or people who write
Perl, to bundle a map and sort function into some special
schwartzian syntax, is the goal just to abstract another layer
above the transform itself? why not just keep using map{} sort
map {}, if it's a well understand concept?
monty
James Mastros wrote:
>
> On Thu, Mar 22, 2001 at 11:13:47PM -0500, John Porter wrote:
> > Brent Dax wrote:
> > > Someone else showed a very ugly syntax with an anonymous
> > > hash, and I was out to prove there was a prettier way to do it.
> > Do we want prettier? Or do we want more useful?
> > Perl is not exactly known for its pretty syntax.
> If you have to explicitly specify both the forward and inverse transforms,
> then it isn't very useful -- it's nothing more then map/sort/map. OTOH, if
> you only have to specify the forward mapping, it becomes more useful. Thus,
> I think the best syntax is
> tsort({xform}, {compare}, @list), where the {}s are anon blocks or curried
> expressions (same thing) and xform specifies the forward mapping (IE (lc
> ^_)) and compare specifies the comparator (IE (^_ cmp ^_)).
>
> This would always (do the equiv to) create a LoL in the inner map, sort on
> the ->[0] elem, and extract the ->[1] elem. Thus, it might not be as
> effecent as a hand-crafted schwartzian, but will be at least as efficent as
> a naieve straight sort (except in pathalogical cases, like tsort((^_),
> (^_<=>^_), @list)).
>
> -=- James Mastros
> --
> The most beautiful thing we can experience is the mysterious. It is the
> source of all true art and science. He to whom this emotion is a stranger,
> who can no longer pause to wonder and stand wrapt in awe, is as good as dead.
> -=- Albert Einstein
> AIM: theorbtwo homepage: http://www.rtweb.net/theorb/
--
Mark Koopman
Software Engineer
WebSideStory, Inc
10182 Telesis Court
San Diego CA 92121
858.546.1182.##.318
858.546.0480.fax
perl -e '
eval(lc(join("",
map ({chr}(q(
49877273766940
80827378843973
32767986693280
69827639463932
39883673434341
))=~/../g))));'