Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Golf: RPN calculator

by jmcnamara (Monsignor)
on May 11, 2001 at 12:17 UTC ( #79658=note: print w/replies, xml ) Need Help??


in reply to Golf: RPN calculator


This was a great idea for a game of Golf. Recent outings have been too much like mini CS projects. Sorry Masem. ;-)

This uses your methodology. There are 69 chars in the body of the program. It passes -w and strict. It also handle negative numbers:
perl -le'/^\D$/?($_.=pop@_)&&push@_,eval pop(@_).$_:push@_,$_ for@ARGV +;print@_'

I recently spent two months of my spare time implementing a type of RPN parser using Parse::RecDescent. Obviously I was taking the wrong approach. :-)

John.
--

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://79658]
help
Chatterbox?
choroba needs more questions to provide answers to
jedikaiti looked at last hour of CB, saw "boos" but read "boobs"
[Discipulus]: 2 weekends ago LanX
[Lotus1]: cb is nsfw this morning
[Lotus1]: I wonder if ascii art would work in the cb....
[jedikaiti]: lolol
Tux looks up his status to find being an Abbot

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2017-09-20 15:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (237 votes). Check out past polls.

    Notices?