user-pic

Joel Berger

  • Website: github.com/jberger
  • About: As I delve into the deeper Perl magic I like to share what I can.
Subscribe to feed Recent Actions from Joel Berger

  • Sid Burn commented on map/grep is not a real iterator?

    map/grep are no iterators at all. They just read the whole list, apply the function to every element and return a new list.

    Perl itself doesn't have special iterator support. But you still can write something as an iterator, but you have to do it on your own.

    For example you create a function that returns a function that uses an closure. Or you just use OOP for keep tracking of the current state and so on.

  • http://openid.aliz.es/anonymous commented on The map/grep/sort dead end

    That's one apples to oranges comparison if I've ever seen one (library vs. built-in functions).

    > So, why don't we have something like LINQ in Perl?

    > Absolutely nobody thought about wrapping it in objects and wrapping it in iterators.

    That's a bold claim, are you trolling to be proved wrong? Have a look at CPAN. Off the top of my head: Data::CapabilityBased List::Gen Generator::Object Object::Iterate

    There's more.

  • Sid Burn commented on The map/grep/sort dead end

    Thanks. I never looked in the Mojo::* namespace because i primarly used Catalyst and didn't even expect that something like that would be in Mojo::*. At least it helps to make it better readable. A Lamba Syntax is just an addition. You can also define anonymous functions in C# with delegate(){...}. I also would like to see something like this in Perl. It doesn't mean that the syntax for anonymous subroutines will be replaced, it is just another way to write them.

    Instead of

    $collection->map(sub { ucfirst })->shuffle->each(sub {
    my ($word, $count) = @_;

  • Sid Burn commented on The map/grep/sort dead end

    Three of the modules you mentioned aren't even usable, are still in the concept phase, or just provide a wrapper around Iterators but not really compareable to something like LINQ in C#.

    Data::CapabilityBased is just an idea how it could look like and didn't even have any code.

    The only thing that really looks promising and comes close to LINQ in C# is List::Gen with List::Gen::Lazy. When i am coding again in Perl i will test it out, thanks for the tip.

  • Chris K commented on Subroutine Calling Conventions

    Hey Ron,

    I am writing these tutorials from the perspective of a beginner/casual user. In other words, I'm sharing what I know for the fun of it, with the expectation that some things I do will be wrong. It's an evolutionary process.

    That said, I'll probably take a look at that reference. Thank you.

Subscribe to feed Responses to Comments from Joel Berger

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is run by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.