Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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.

Comment on Monads in Perl
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 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

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.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2014-07-12 15:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (240 votes), past polls