How much has RPN/RPL spoiled you?
|
06-05-2015, 11:54 PM
Post: #32
|
|||
|
|||
RE: How much has RPN/RPL spoiled you?
(06-04-2015 01:16 PM)Dave Britten Wrote: RPN (and RPL) is fantastic for number crunching, or small programs that augment the built-in functions, but for building a large, sophisticated application, it's painful at best, especially with no GOTO in RPL. Compared to a symbolic language, the code is almost always opaque and barely maintainable, with no immediately obvious connection to what's getting passed as a parameter to what, and a lack of any code commenting ability. Solving a quadratic equation is probably something all of us are familiar with: \( ax^2 + bx + c = 0 \) However I'm not using the quadratic formula but transform the equation into this reduced form: \( x^2 - 2px + q = 0 \) By comparing the coefficients we find: \( p = \frac{b}{-2a} \) \( q = \frac{c}{a} \) The solutions for this equation are: \( x_{1,2} = p \pm D \) where \( D = \sqrt{p^2-q} \) Compare these two solutions: Code: \<< Code: \<< Which one is easier to understand? But we can split the calculation into three tasks:
Code: %%HP: T(3)A(R)F(.); This also allows to test each of them individually. Quote:(RPL is often called a write-only language, and I think I've heard the same epithet applied to perl and/or regular expressions.) Whether your code is maintainable has little to do with the programming language you use. It is more related to how the code is organized. Using subroutines or local variables is a way to give meaningful names. This helps to understand and thus maintain the code. Cheers Thomas |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)