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

Re: Golf: RPN calculator

by danger (Priest)
on May 10, 2001 at 19:56 UTC ( #79446=note: print w/ replies, xml ) Need Help??


in reply to Golf: RPN calculator

Here's one in 24 characters (not counting shebang):

#!/usr/bin/perl -wl print eval"@ARGV[0,2,1]"

Update: ARGG! I started along the lines of japhy's solution and suddenly, for no apparent reason, my brain skipped a neuron or ten and decided that one postfix op was the entire problem instead of an arbitrary rpn expression. Move along now ... no need to slow down and stare at the crash victim ...


Comment on Re: Golf: RPN calculator
Download Code
Replies are listed 'Best First'.
Re: Re: Golf: RPN calculator
by Sprad (Hermit) on May 10, 2001 at 20:16 UTC
    What if I feed it this:
    1 1 1 1 1 + + + +
    ?

    ---
    A fair fight is a sign of poor planning.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://79446]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2015-08-02 16:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (4 votes), past polls