Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Tales from writing a RPN evaluator in Perl 5, Perl 6 and Haskell

by eyepopslikeamosquito (Chancellor)
on Jan 04, 2006 at 09:23 UTC ( #520826=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    package Rpn;
  2. or download this
    use strict;
    use warnings;
        eval { Rpn::evaluate($t->[0]) };
        is($@, $t->[1]);
  3. or download this
    module Rpn-0.0.1-cpan:ASAVIGE;
        @stack.elems == 1 or die "Invalid stack:[@stack[]]\n";
        return @stack[0];
  4. or download this
        try { Rpn::evaluate($t[0]) };
        is($!, $t[1]);
  5. or download this
    {-# OPTIONS_GHC -fglasgow-exts -Wall #-}
      | otherwise       = error $ "Invalid stack:" ++ show el
      el = foldl evalStack [] $ words expr
  6. or download this
    {-# OPTIONS_GHC -fglasgow-exts -Wall #-}
    main :: IO Counts
    main = do runTestTT normalTests
              runTestTT exceptionTests
  7. or download this
    (Control.Exception.evaluate (Rpn.evaluate x))
  8. or download this
    f (x:y:zs) "+" = y+x:zs
  9. or download this
    import Debug.Trace
    -- ...
    f (x:y:zs) "+" = trace ("+" ++ show x ++ ":" ++ show y ++ ":" ++ show 
    +zs) (y+x:zs)
  10. or download this
    autrijus stares at type Eval x = forall r. ContT r (ReaderT x IO) (Rea
    +derT x IO x)
    and feels very lost
    <shapr> Didn't you write that code?
    <autrijus> yeah. and it works
    <autrijus> I just don't know what it means.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://520826]
Approved by Corion
Front-paged by Corion
[Corion]: (that module has been deprecated by its author already, so that's fair. Although I wonder why the backtracking can't be fixed to handle the formfeeds gracefully)
[choroba]: not enough tuits?
[Corion]: choroba: Yeah, maybe. I'm also unaware of who uses Email:: modules, but that's more my limited horizon of things ;)
[Corion]: Ah - there even is the replacement of Email::Address::XS , by the bug reporter, which hopefully fixes this bug already ;)

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2018-06-20 12:00 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (116 votes). Check out past polls.