Post Reply 
Looking for userRPL examples
04-22-2014, 04:22 PM (This post was last modified: 04-22-2014 04:30 PM by Claudio L..)
Post: #1
Looking for userRPL examples
Hello,
As newRPL slowly progresses, we are in need of small code examples to use in the docs.
Examples need to be short and straight to the point.
But the idea is that the examples should do something cool or fun at the same time, so the docs are not so hard to swallow.
Does anybody know of a collection of userRPL "gems" anywhere?
Or if each of you share their own favorite code snippets here, we can create a small collection of them.
Here's an example that shows how to do linear interpolation, using only stack commands:
given x0 y0 x1 y1 x, returns y corresponding to the point in the same straight line as (x0,y0) and (x1,y1), that has coordinate x.
Code:

<< 3. PICK - 5. ROLL 4. ROLL - / 3. ROLL 3. PICK - * + >>

I know, it isn't that great but shows the use of PICK and ROLL commands, while doing something meaningful. Then we can rewrite the same example but using local variables to show a different way to do it. This is the kind of examples we are looking for.

Thanks
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Looking for userRPL examples - Claudio L. - 04-22-2014 04:22 PM



User(s) browsing this thread: 1 Guest(s)