Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^4: Understanding the Schwartzian transform.

by Anonymous Monk
on Jul 22, 2013 at 08:03 UTC ( #1045611=note: print w/replies, xml ) Need Help??

in reply to Re^3: Understanding the Schwartzian transform.
in thread Understanding the Schwartzian transform.

but, definitely, the "output_array = map {block} sort {block} map {block} input array" is the canonical for of the Schwartzian Transform.

Sorry, that is like the generic form of Guttman-Rosler Transforms (see links) except without the secret ingredient :)(normalize/restore)

Schwartzian is

my @sorted = map { restore_from_cache } sort { by_cached_expensive } map { store_cache_expensive } @original;

Replies are listed 'Best First'.
Re^5: Understanding the Schwartzian transform.
by Laurent_R (Abbot) on Jul 22, 2013 at 15:54 UTC

    Sorry, but except that I did not detail what goes into the code blocks (as this has been detailed well enough the the previous posts), I do not see any difference between your version of the Schwartzian Transform and mine.

      Because in GRT, you just change the data so they can be sorted lexicographically as strings, while in Schwartzian transform, you create a structure. You can simplify both to map {} sort {} map {} list (in GRT, sort block can be omitted), their difference can be seen only if you give more details.
      لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

        Agreed, but: 1. the OP did not ask for the difference between Guttman-Rosler and Schwartzian transforms, but only if MJD's code he had was a canonical ST. And this example is a canonical ST, which it what I said. The fact that I somewhat summarized for brevity (and because it could be other code for a different probklem and still be a ST) does not invalidate my point and certainly does not make the OP's initial code nor the summary that I made a GR transform. As you said, a GR transform would have omitted the sort block. I reallyt think that the OP question was whether the standard ST consists of the map-sort-map construct.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1045611]
[Corion]: A good daystart to everybody!
[Corion]: Just a quick poll - is anybody actively relying on https://perlmonks. I plan to retire that URL in favour of moving all our servers onto the same HTTPS certificate for perlmonks.{com, net,org}
[Corion]: Actually bsd_glob '{www.,}perlmonks .{com,net,org}', plus I think
[Corion]: Sad that Let's Encrypt does not allow wildcard certificates, but they could be somewhat of a hassle to verify

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2017-09-26 07:45 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (292 votes). Check out past polls.