Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Monads in Perl

by sleepingsquirrel (Chaplain)
on Aug 30, 2004 at 14:12 UTC ( [id://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?
Username:
Password:

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
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2024-04-23 16:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found