Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #8897

prefix notation question

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!74.125.46.80.MISMATCH!postnews.google.com!13g2000prp.googlegroups.com!not-for-mail
From Chad <cdalten@gmail.com>
Newsgroups comp.lang.java.programmer
Subject prefix notation question
Date Sun, 16 Oct 2011 20:15:19 -0700 (PDT)
Organization http://groups.google.com
Lines 17
Message-ID <c865e53f-1e45-420b-aef3-cfb37216db89@13g2000prp.googlegroups.com> (permalink)
NNTP-Posting-Host 66.81.36.69
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
X-Trace posting.google.com 1318821734 5159 127.0.0.1 (17 Oct 2011 03:22:14 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Mon, 17 Oct 2011 03:22:14 +0000 (UTC)
Complaints-To groups-abuse@google.com
Injection-Info 13g2000prp.googlegroups.com; posting-host=66.81.36.69; posting-account=kTs1ygoAAACgG1TSoyECpovEyy-V6_8b
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-Header-Order ARLUEHNKC
X-HTTP-UserAgent Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.2),gzip(gfe)
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8897

Show key headers only | View raw


I'm supposed to write a program that calculates arithmetic expressions
using prefix notation. The one example our professor gave us is

(+ (- 6) (* 2 3 4) (/ (+ 3) (* 1) (- 2 3 1)))

Which evaluated sucessively becomes..

(+ (- 6) (* 2 3 4) (/ 3 1 -2)) //<----I don't see how he arrives at
this expression
(+ -6 24 -1.5)
16.5

I don't see how he gets (+ (- 6) (* 2 3 4) (/ 3 1 -2)) from (+ (- 6)
(* 2 3 4) (/ (+ 3) (* 1) (- 2 3 1)))

Chad

Back to comp.lang.java.programmer | Previous | NextNext in thread | Find similar | Unroll thread


Thread

prefix notation question Chad <cdalten@gmail.com> - 2011-10-16 20:15 -0700
  Re: prefix notation question Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-10-16 20:46 -0700
    Re: prefix notation question Chad <cdalten@gmail.com> - 2011-10-16 20:58 -0700
      Re: prefix notation question Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-10-16 23:38 -0700
      Re: prefix notation question Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2011-10-17 10:06 +0300
        Re: prefix notation question Chad <cdalten@gmail.com> - 2011-10-17 07:39 -0700
          Re: prefix notation question Chad <cdalten@gmail.com> - 2011-10-17 07:45 -0700
            Re: prefix notation question Chad <cdalten@gmail.com> - 2011-10-17 07:50 -0700
              Re: prefix notation question Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2011-10-17 18:10 +0300
                Re: prefix notation question Chad <cdalten@gmail.com> - 2011-10-18 15:30 -0700
                Re: prefix notation question Roedy Green <see_website@mindprod.com.invalid> - 2011-10-18 19:40 -0700
  Re: prefix notation question Roedy Green <see_website@mindprod.com.invalid> - 2011-10-18 19:36 -0700

csiph-web