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

Monads in Perl

by sleepingsquirrel (Hermit)
on Aug 30, 2004 at 14:12 UTC ( #386923=perlmeditation: print w/replies, xml ) Need Help??

In the past, we've had meditaton on coroutines, continuations, haskell, and other functional topics. So I thought I'd throw my recently completed "Monads in Perl" tutorial out there for discussion. There is no real reason to use monads in perl, but hey, TMTOWTDI.

-- All code is 100% tested and functional unless otherwise noted.

Replies are listed 'Best First'.
Re: Monads in Perl
by jryan (Vicar) on Aug 31, 2004 at 17:50 UTC
    As you said, "hey, TMTOWTDI." (:
    print parse_equation("Div Div Con 18 Con 2 Con 3"); # just a sexeger sub parse_equation { my $r = reverse $_[0]; $r =~ s!(\d+(?:\.\d+)?) noC (\d+(?:\.\d+)?) noC viD! reverse($2)/reverse($1) . ' noC' !e while $r =~ /viD/; return scalar reverse $r; }
Re: Monads in Perl
by adrianh (Chancellor) on Sep 01, 2004 at 13:19 UTC

    This is nitpicking an otherwise nice little article (sorry :-) but:

    closures (also know as anonymous subroutines)

    I really wish that people wouldn't use closures and anonymous subroutines as synonyms. Not all closures are anonymous. Not all anonymous subroutines are closures.

    I know people do - but we shouldn't encourage them! It only leads to confusion.

Re: Monads in Perl
by FoxtrotUniform (Prior) on Aug 31, 2004 at 22:02 UTC

    Nice tutorial!

    Anyone else interested in joining the PerlMonks Haskell Fanboys Club? :-)

    F o x t r o t U n i f o r m
    Found a typo in this node? /msg me
    % man 3 strfry

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://386923]
Approved by bassplayer
Front-paged by grinder
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2023-04-02 02:46 GMT
Find Nodes?
    Voting Booth?

    No recent polls found