Code Comments
Programming Forum and web based access to our favorite programming groups.Abdulaziz Ghuloum wrote: > Here is another rpn (also with no error handling, interactivity, ...). > It also assumes that all operators are binary. > Also, this rpn has no side effects. Yours is pure functional, but mine doesn't have any external side-effects (does that phrasing make sense?). I *used* bangs internally for brevity, but my rpn still just take stuff in, and put stuff out. I'd still use it in an otherwise pure functional program. I toyed with something that looked like your program for a while before things settled down, and my factorings were made. I actually found the pure functional version harder to debug/grok as I was writing it; it juggles a lot more state around, explicitly, and it's longer. An interesting property of your program is that it's iterative, mine is recursive. (And the fact that it had to be *reverse* polish notation complicated my program (remove the reverse line and switch b and c, and call it pn), while yours work with it.) I guess you always think the version you write yourself looks the clearest...
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.