Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

RFC: Acme::BottomsUp

by davidrw (Prior)
on Aug 14, 2006 at 18:57 UTC ( #567298=perlmeditation: print w/replies, xml ) Need Help??

Acme::BottomsUp - Write individual statements backwards
This is a fun mostly proof-of-concept module that I'm looking for comments on, especially alternative ways to code it and sample usage /possibilities (practical or otherwise)... It uses Filter::Simple and PPI ; source code below.
Update: 2006-08-15 uploaded to cpan as Acme::BottomsUp

my @arr = (1..10); use Acme::BottomsUp; @arr # first, start w/ numbers grep { $_ % 2 } # then get the odd ones map { $_**3 } # then cube each one join ":", # and glue together print # lastly, display result ; print "ok"; no Acme::BottomsUp;
This module allows you to write multi-line perl statements in reverse order so that it "reads better". For example, normally one would write the code from the SYNOPSIS as:
my @arr = (1..10); print # lastly, display result join ":", # and glue together map { $_**3 } # then cube each one grep { $_ % 2 } # then get the odd ones @arr # first, start with numbers ;

The full source:
package Acme::BottomsUp; use warnings; use strict; our $VERSION = '0.01'; use Filter::Simple; use PPI; FILTER { my $doc = PPI::Document->new(\$_); $_ = join '', map { my $s = $_->content; $s =~ s/;\s*$//s; join("\n", reverse split "\n", $s ) . "\n;" } @{ $doc->find('PPI::Statement') }; }; 1;

Considered (Marza): Split off the "offensive" talk to it's own thread or delete the posts as they have nothing to do with the topic
Unconsidered (holli): enough keep votes (Keep: 13, Edit: 4, Reap: 1)

Replies are listed 'Best First'.
Re: RFC: Acme::BottomsUp
by eyepopslikeamosquito (Chancellor) on Aug 14, 2006 at 21:21 UTC

    Cute. Reminds me of Perl 6 Feed operators. From S06:

    Leftward feeds are a convenient way of explicitly indicating the typical right-to-left flow of data through a chain of operations:
    @oddsquares = map { $_**2 }, sort grep { $_ % 2 }, @nums; # more clearly written as... @oddsquares = map { $_**2 } <== sort <== grep { $_ % 2 } <== @nums +;
    Rightward feeds are a convenient way of reversing the normal data flow in a chain of operations, to make it read left-to-right:
    @oddsquares = (@nums ==> grep { $_ % 2 } ==> sort ==> map { $_**2 });
    Note that the parens are necessary there due to precedence.

      I had no idea that the feed operator existed, but *that* is cool. Thanks for giving me a good reason to go read some Perl6 documentation...
Re: RFC: Acme::BottomsUp
by Fletch (Chancellor) on Aug 14, 2006 at 19:58 UTC

    Next write Acme::YodaStatement you must, hrrrmmmm?

      You mean like this old node?

      Alex / talexb / Toronto

      "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Re: RFC: Acme::BottomsUp
by DrHyde (Prior) on Aug 14, 2006 at 20:06 UTC
    Galloping gay christ that's hideous!

    Well done!

    Considered (Argel): Reap: Inappropriate in certain work envrionments and since it is off-topic no reason to keep it
    Unconsidered (holli): enough keep votes (Keep: 11, Edit: 0, Reap: 3)

      While it is possible that the above post was whimsically-intended (I do try to keep a good sense of humor on this site), I'd have to say that I find this particular exclamation deeply offensive. I don't understand the mindset of someone who takes a thing that is precious and sacred to others and profanes it in this way. Take it from me; among those who honor the name of Jesus, this particular combination of terms is the written equivalent to a slap in the face. I have come to expect a higher level of maturity from the PerlMonks community.

      Admittedly, there are alternative (pun intended) uses for the word 'gay' and certainly Jesus was not the only person who is claimed to be a 'christ', but the casual intent to defile seems evident in this post.

      I don't really have a problem with 'galloping', although it seems likely to be historically inaccurate. :)

      Whatever your meta-ethical viewpoint (or lack thereof) it seems to me that a small amount of decency and respect for others would go a long way in terms of refraining from posts like this.

        Take it from me; among those who honor the name of Jesus, this particular combination of terms is the written equivalent to a slap in the face.

        Sigh. See, this is exactly the problem I have with the easily-offended:

        1. The post in question never actually uses the name "Jesus"
        2. The word "christ" is just anglicized Greek for "annointed one"
        3. You've assumed that every person who honors Jesus Christ (that is, every Christian) agrees with you
        4. You've assumed that something offensive isn't still funny

        I'm not Christian anymore, but still have a great respect for the religion (after all, I used to be an ordained minister) and for the teachings of Christ. I found the phrase "galloping gay christ" to be hilarious.

        A quick informal poll among my friends (many of whom are devout Christians) revealed that 80% thought the phrase was funny; of those who thought it wasn't funny, none cited "offensive" as even part of the reason.

        This is now horribly off-topic (sorry, folks), but I think it's important to understand that posting "offensive" material -- especially when it's clearly intended to be humorous, doesn't mean the poster has a "lack of respect for others".

        A collection of thoughts and links from the minds of geeks
        The Code that can be seen is not the true Code
        I haven't found a problem yet that can't be solved by a well-placed trebuchet
        A slap in the face? That sounds so familiar.

        "But I tell you, do not resist an evil person. If someone strikes you on the right cheek, turn to him the other also."

        DrHyde is also well known in certain circles as "Evil Dave". So, there you have it, straight from the Sermon on the Mount.

        This appears to be where The Christians are going wrong. Simply considering a node because it is found offensive. Comes across as a bit, well, feeble.

        I'd recommend boycotting his export goods and burning down a few of his embassies, then people will really know how upset you are.

        Apologies to any Danish People who might have been offended by this post, but you know how it is.


        Seriously? I mean are you serious? Because in your defense of your christ you claim that calling someone gay is an insult. Are you so lacking in maturity that you think your own actions are okay?

        I realy hope that you were joking and it just didn't come accross in your post. Otherwise you should consider that your own post was highly offensive. Your own intent to defile a populations life style wasn't casual and was certainly offensive. I don't want to start this argument so don't consider it a challenge in need of a reply, consider it instead simply another point of view that perhaps you weren't aware of.

        /me considers considering his own node for removal....well the masses can make that decision.

        Eric Hodges

        If you study the scriptures, it's obvious that Christ was gay. There are gay people right now (this is indisputable) who are made in the image of God (so says Genesis). JAYSUS was God (we know this because christians worship him and yet claim to not be polytheists). Therefore gay people were made in his image. Therefore he was a mincing poofter. I hope you're a backdoor boy, cos if you're not then perhaps you're an agent of Satan and you defile God's creation.

        A witch! A witch! Burn the hetero!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://567298]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2017-11-25 11:57 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (355 votes). Check out past polls.