Subject: Re: RPN
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 1999/11/30
Newsgroups: comp.lang.scheme
Message-ID: <820gvf$6j3js@fido.engr.sgi.com>
<a.a@yale.edu> wrote:
+---------------
| Does anyone know the implementation of rpn (reverse polish notation) in
| scheme.  The program should be able to calculate an equation of the form
| 2 3 + 5 / but should be rpn implementation.
+---------------

	> (eval (tree-reverse '((2 3 +) 5 /)))
	1
	> 

[Writing "tree-reverse" is left as an exercise for the student...]


-Rob

p.s. Hint:

	> (tree-reverse '((2 3 +) 5 /))
	(/ 5 (+ 3 2))
	> 

-----
Rob Warnock, 8L-846		rpw3@sgi.com
Applied Networking		http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673
1600 Amphitheatre Pkwy.		FAX: 650-933-0511
Mountain View, CA  94043	PP-ASEL-IA