News for hackers. Stuff that matters.
Re:Learning Haskell/Python makes you a worse C# programmer by cygx on Sunday November 25, 2012 @02:15PM (#4828927)
I'll see your Perl5 and raise you some Perl6:

    @list.map(*.description).grep(?*).join("\n")
Re:Learning Haskell/Python makes you a worse C# programmer by yen223 on Sunday November 25, 2012 @03:39PM (#4829218)
That can't be Perl, I actually understood it.
Re:Learning Haskell/Python makes you a worse C# programmer by gecko on Sunday November 25, 2012 @02:29PM (#4828982)
That is starting to look more like J or K than Perl. Is the Perl 6 team still considering syntax changes? If so, any thought on making map/grep/join operators?
Re:Learning Haskell/Python makes you a worse C# programmer by cygx on Sunday November 25, 2012 @04:13PM (#4829300)
map, grep and join are subs as well as methods. Perl6 is a multi-paradigm language and of course there's more than one way to do it - even when using the same operations.

Instead of chaining methods, one could also use

    # p5 style
    join "\n", grep ?*, map *.description, @list;

    # dataflow style
    @list ==> map *.description ==> grep ?* ==> join "\n";
    join "\n" <== grep ?* <== map *.description <== @list;
Re:Learning Haskell/Python makes you a worse C# programmer by draegtun on Tuesday November 27, 2012 @05:18AM (#4836507)
Perl6 allows you to define your own operators:

  $ perl6

  > sub infix:<J>   ($sep, @list) { @list.join($sep) }
  > sub prefix:<J,> (@list)       { @list.join(',')  }

  > ':' J <one two three four>;
  one:two:three:four

  > J,<five six seven eight>;
  five,six,seven,eight