[perl-python] 20050117, filter, map

Discussion in 'Python' started by Xah Lee, Jan 17, 2005.

  1. Xah Lee

    Xah Lee Guest

    © # -*- coding: utf-8 -*-
    © # Python
    ©
    © # the "filter" function can be used to
    © # reduce a list such that unwanted
    © # elements are removed.
    © # example:
    ©
    © def even(n): return n % 2 == 0
    © print filter( even, range(11))
    ©
    ©
    © # the "map" function applies a function
    © # to all elements of a list. Example:
    ©
    © def square(n): return n*n
    © print map(square, range(11))
    ©
    © ------------------------------------
    © # similar perl versions
    ©
    © use Data::Dumper;
    © sub even {return $_[0]%2==0};
    © print Dumper[ grep {even $_} (0..10)];
    ©
    ©
    © # sub square {$n=shift;$n**2;};
    © sub square {(shift)**2;};
    © print Dumper [ map {square($_)} (0..10)];
    ©
    © # the codes above showcase some syntax
    © # variations commonly found in perl code
    © # base
    ©
    © -------------------------
    ©
    © # in Mathematica for example, filter is
    © # akin to Apply and map is MapThread.
    © # The standard Map can be applied
    © # according to a level spec of trees
    © # and there's also MapAt, Nest,
    © # NestList...any many more powerful
    © # functions that manipulates trees.
    © # lisp languages often have a subset
    © # of it.
    ©
    © ----------------------------
    © Note: this post is from the Perl-Python
    © a-day mailing list at
    © http://groups.yahoo.com/group/perl-python/
    © to subscribe, send an email to
    © if
    © you are reading it on a web page,
    © program examples may not run because
    © html conversion often breaks the code.
    ©
    © Xah
    ©
    © http://xahlee.org/PageTwo_dir/more.html
    Xah Lee, Jan 17, 2005
    #1
    1. Advertising

  2. Xah Lee wrote:
    > © Note: this post is from the Perl-Python
    > © a-day mailing list at
    > © http://groups.yahoo.com/group/perl-python/


    Is there any chance you could post these all as part of the same thread?
    That would be really nice for those of us who aren't interested --
    then we could just ignore the thread...

    Thanks in advance,

    Steve
    Steven Bethard, Jan 17, 2005
    #2
    1. Advertising

  3. Steven Bethard wrote:

    > Is there any chance you could post these all as part of the same thread?
    > That would be really nice for those of us who aren't interested --
    > then we could just ignore the thread...


    Or, better yet, not posting it at all. He's got his mailing list, what
    does he need to post it here for?

    --
    Erik Max Francis && && http://www.alcyone.com/max/
    San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
    Make it come down / Like molasses rain
    -- Sandra St. Victor
    Erik Max Francis, Jan 17, 2005
    #3
  4. Xah Lee

    Steve Holden Guest

    Erik Max Francis wrote:

    > Steven Bethard wrote:
    >
    >> Is there any chance you could post these all as part of the same
    >> thread? That would be really nice for those of us who aren't
    >> interested -- then we could just ignore the thread...

    >

    You are looking for evidence of cluefulness where it seems unlikely to
    ever appear.
    >
    > Or, better yet, not posting it at all. He's got his mailing list, what
    > does he need to post it here for?
    >

    As I may have mentioned before, egotism can be the only possible reason.

    regards
    Steve
    --
    Steve Holden http://www.holdenweb.com/
    Python Web Programming http://pydish.holdenweb.com/
    Holden Web LLC +1 703 861 4237 +1 800 494 3119
    Steve Holden, Jan 17, 2005
    #4
  5. Xah Lee

    Nick Coghlan Guest

    Steve Holden wrote:
    > As I may have mentioned before, egotism can be the only possible reason.


    I'd merely figured it as a textbook case of trolling - attention seeking
    behaviour, most likely indicative of a lack of self-esteem, rather than the reverse.

    Still, he does at least keep the [perl-python] mailing list tag, so automatic
    filtering isn't that difficult. It is an unfortunate shame that his
    consideration doesn't extend to removing the general Perl and Python discussion
    groups from his recipients list.

    Cheers,
    Nick.

    --
    Nick Coghlan | | Brisbane, Australia
    ---------------------------------------------------------------
    http://boredomandlaziness.skystorm.net
    Nick Coghlan, Jan 17, 2005
    #5
  6. Steven Bethard wrote :
    > Xah Lee wrote:
    >> © Note: this post is from the Perl-Python
    >> © a-day mailing list at
    >> © http://groups.yahoo.com/group/perl-python/

    >
    > Is there any chance you could post these all as part of the same thread?
    > That would be really nice for those of us who aren't interested --
    > then we could just ignore the thread...


    I would appreciate that, too.
    But I fear this person doesn't even read the comments on his unwanted
    load.

    I guess I'll scorefile the "Subject" of these postings, too, to get rid of
    this.


    --
    Epur Si Muove (Gallileo Gallilei)
    Martin Kissner, Jan 17, 2005
    #6
  7. Xah Lee

    Xah Lee Guest

    Xah Lee, Jan 17, 2005
    #7
  8. Xah Lee

    Xah Lee Guest

    Xah Lee, Jan 17, 2005
    #8
  9. Xah Lee

    Abigail Guest

    Steven Bethard () wrote on MMMMCLVII September
    MCMXCIII in <URL:news:>:
    $$ Xah Lee wrote:
    $$ > © Note: this post is from the Perl-Python
    $$ > © a-day mailing list at
    $$ > © http://groups.yahoo.com/group/perl-python/
    $$
    $$ Is there any chance you could post these all as part of the same thread?


    Just killfile him, and stop replying. Remember, don't feed the trolls.



    Abigail
    --
    my $qr = qr/^.+?(;).+?\1|;Just another Perl Hacker;|;.+$/;
    $qr =~ s/$qr//g;
    print $qr, "\n";
    Abigail, Jan 17, 2005
    #9
  10. >>>>> "SH" == Steve Holden <> writes:

    SH> As I may have mentioned before, egotism can be the only
    SH> possible reason.

    Relevant links:

    "On Ignoring Trolls":
    http://www.xahlee.org/UnixResource_dir/writ/troll_ignorance.html
    "A Troll's Anthology":
    http://www.xahlee.org/UnixResource_dir/writ/troll_anthology.html

    He admits to being a troll, and he enjoys trolling. I suspect this
    thread was intended to stir up a flame war among Perl and Python
    users; all it's done is demonstrate how hopeless Xah is as a
    programmer even in a language he claims to be an expert in.

    Charlton



    --
    cwilbur at chromatico dot net
    cwilbur at mac dot com
    Charlton Wilbur, Jan 17, 2005
    #10
  11. Abigail wrote:
    > Steven Bethard () wrote on MMMMCLVII September
    > $$ Is there any chance you could post these all as part of the same
    > thread?
    >
    > Just killfile him, and stop replying. Remember, don't feed the trolls.


    True, except that he spreads lies about Perl and really bad code all over
    the place.
    If you don't tell people about how awful his skills are then they may
    actually mistake his incompetency for flaws in Perl.

    jue
    Jürgen Exner, Jan 18, 2005
    #11
  12. Erik Max Francis <> wrote:
    > Steven Bethard wrote:
    >
    >> Is there any chance you could post these all as part of the same thread?
    >> That would be really nice for those of us who aren't interested --
    >> then we could just ignore the thread...

    >
    > Or, better yet, not posting it at all. He's got his mailing list, what
    > does he need to post it here for?



    There isn't much point in trolling if you don't have an audience.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Jan 18, 2005
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ben

    map, filter & reduce...

    Ben, Nov 16, 2003, in forum: Python
    Replies:
    4
    Views:
    417
    Inyeol Lee
    Nov 20, 2003
  2. Logan

    filter and map / deprecated?

    Logan, Dec 17, 2003, in forum: Python
    Replies:
    5
    Views:
    479
    Raymond Hettinger
    Dec 18, 2003
  3. Andrey Tatarinov

    Python3: on removing map, reduce, filter

    Andrey Tatarinov, Jan 9, 2005, in forum: Python
    Replies:
    18
    Views:
    1,219
    Steven Bethard
    Jan 11, 2005
  4. zax75
    Replies:
    1
    Views:
    1,092
  5. Xah Lee

    [perl-python] 20050117, filter, map

    Xah Lee, Jan 17, 2005, in forum: Perl Misc
    Replies:
    9
    Views:
    107
    Tad McClellan
    Jan 18, 2005
Loading...

Share This Page