Post Reply 
newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
10-25-2017, 06:45 PM (This post was last modified: 10-25-2017 06:46 PM by Claudio L..)
Post: #201
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
(10-25-2017 01:34 PM)Gilles59 Wrote:  Hi Claudio, did you think about the possibilty to introduce EXIT and BREAK instructions in NewRPL?

Still thinking about it. The problem with doing that is the cleanup of local environments when you have premature exit. If I can resolve that in a clean way I'll of course include those two.

(10-25-2017 04:10 PM)The Shadow Wrote:  The one benefit of lists being evaluated as programs was that such programs were easy to alter on the fly. However, it certainly isn't hard to use strings to change programs to lists and vice versa, and I currently have a newRPL program that does just that. (Also one to change regular programs to immediate ones.)

Not having to constantly type << EVAL >> MAP, on the other hand, to say nothing of AXL << EVAL >> MAP AXL, may have saved me from carpal tunnel. Smile

If you need to run a list as a program, you can still do it, but now you need:
<< XEQ >> MAP
sounds familiar?
But don't get your hopes up, all the loop and control structures, cannot be executed by XEQ (will do nothing), as they need a proper run stream. However, stack based commands work fine, like IFT, IFTE, etc.
In any case, I don't think self-modifying code masqueraded as lists is a very good programming technique.

EDIT: Forgot to mention, all roms were updated with latest bugfixes. See the first post.
Find all posts by this user
Quote this message in a reply
10-25-2017, 07:42 PM
Post: #202
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
(10-25-2017 06:45 PM)Claudio L. Wrote:  In any case, I don't think self-modifying code masqueraded as lists is a very good programming technique.


I agree, but there are a few limited cases where it can do things hard to do in UserRPL otherwise.

Quote: EDIT: Forgot to mention, all roms were updated with latest bugfixes. See the first post.

Yay! Will download as soon as I get home from work!
Find all posts by this user
Quote this message in a reply
10-25-2017, 10:26 PM (This post was last modified: 10-25-2017 10:26 PM by Gilles59.)
Post: #203
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
TY New version dowloaded ;D

I noticed a limitation with LSTO and parallel processing. Example :
5 { 'a' 'b' } LSTO dont work. Returns error "identifiant expected"

5 {'a' 'b'} STO works but leave {} on the stack
Find all posts by this user
Quote this message in a reply
10-26-2017, 01:20 AM
Post: #204
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
(10-25-2017 10:26 PM)Gilles59 Wrote:  TY New version dowloaded ;D

I noticed a limitation with LSTO and parallel processing. Example :
5 { 'a' 'b' } LSTO dont work. Returns error "identifiant expected"

5 {'a' 'b'} STO works but leave {} on the stack

Indeed that's a limitation of LSTO. Problem is, parallel processing is done by running an RPL program that does MAP, DOLIST, whatever is needed. This is not an atomic operation and uses local variables to save the state. LSTO would run inside that program and the new variable would be created in the wrong local environment.
Find all posts by this user
Quote this message in a reply
10-26-2017, 05:36 PM
Post: #205
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
Here's an example of a newRPL program, a version of VISIT, that I haven't figured out how to do properly without changing a list into a program. If anyone can suggest a more efficient way I've missed, I'd welcome it:

<< DUP RCL IF DUP TYPE 28 == THEN DROP2 ELSE SWAP OVER "VISITBKUP" SDSTO { "EN" DELKEY STOXP } ADD LXP "EN" 0 ASNKEY "DN" KEYEVAL END >>

STOXP stands for STOre with eXtreme Prejudice, and will STO into a variable even if it is locked.

LXP is a name in the same spirit as AXL. It changes lists to programs and vice versa.

The only annoyance in this version of VISIT is that it seems to get the timing wrong at times, exiting the editor without having done DELKEY, leaving the edited object on the stack. If you press Enter again immediately, this will then store it properly. If you don't, you're asking for trouble, which is why I took the trouble of storing a backup on the SD card.

Likewise, if you exit the editor with ON, you'll have to press Enter immediately. It seems one can't add user keys to ON, which is probably wise, though unfortunate in this instance.
Find all posts by this user
Quote this message in a reply
10-26-2017, 08:43 PM
Post: #206
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
(10-26-2017 01:20 AM)Claudio L. Wrote:  
(10-25-2017 10:26 PM)Gilles59 Wrote:  TY New version dowloaded ;D

I noticed a limitation with LSTO and parallel processing. Example :
5 { 'a' 'b' } LSTO dont work. Returns error "identifiant expected"

5 {'a' 'b'} STO works but leave {} on the stack

Indeed that's a limitation of LSTO. Problem is, parallel processing is done by running an RPL program that does MAP, DOLIST, whatever is needed. This is not an atomic operation and uses local variables to save the state. LSTO would run inside that program and the new variable would be created in the wrong local environment.

Regarding the bug in STO: Somehow I enabled parallel processing for STO (when I did all other commands), I'll remove this ASAP, it is clearly a bug.
5 { 'a' 'b' } is not supposed to store 5 in 'a' and 5 in 'b'!
It's supposed to store 5 in variable 'b' inside subdirectory 'a' (lists are paths), which is what it correctly did until I enabled parallel processing. Another regression to fix.
Find all posts by this user
Quote this message in a reply
10-26-2017, 09:05 PM (This post was last modified: 10-26-2017 10:55 PM by Gilles59.)
Post: #207
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
Hi,

Here is a program to find the numbers that are equal to the sum of the cubes of their digits

New RPL Version :
Code:
«
0 9 FOR 'a'
 0 9 FOR 'b'
  0 9 FOR 'c'
   IF 'a*100+b*10+c==a^3+b^3+c^3' THEN {a b c } EVAL END
  NEXT
 NEXT
NEXT
»
TEVAL : 1,06 sec

UserRPL version
Code:

«
0. 9. FOR a
 0. 9. FOR b
  0. 9. FOR c
   IF 'a*100.+b*10.+c==a^3.+b^3.+c^3.' THEN a b c 3. ->LIST END
  NEXT
 NEXT
NEXT
»
TEVAL : 289 sec (slow both in real or exact)

An other way en NewRPL :
Code:
<< 0 999 FOR 'n' n DUP ->STR UTF8-> #30h - 3 ^ ΣLIST == n IFT NEXT >>
TEVAL : 1,56"

UserRPL with GoferList lib (exact mode only):
Code:
 0 999 1 Seq « DUP ->STR Chars STR-> 3 ^ Sum ==  » Filter
TEVAL : who cares ? ;D
EDIT : Surprisingly, faster than previous UserRPL in 201 sec.
Find all posts by this user
Quote this message in a reply
10-26-2017, 09:07 PM
Post: #208
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
(10-24-2017 03:08 AM)Claudio L. Wrote:  I'm well aware that's the only connection to the world for the 39 and 40, and will also be the only connection in a future port to the Prime, so it's very important to get it working.
Thank you.
How do i enter a mixed numbers(1+2/3)? Only as well as HP 50G?
http://www.hpmuseum.org/forum/thread-187...l#pid16759
Quote:I think using double dots would be quick to type:
'3/4' would be 3..4
'1+2/3' would be 1..2..3
Find all posts by this user
Quote this message in a reply
10-26-2017, 09:23 PM (This post was last modified: 10-26-2017 10:28 PM by Gilles59.)
Post: #209
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
(10-26-2017 08:43 PM)Claudio L. Wrote:  Regarding the bug in STO: Somehow I enabled parallel processing for STO (when I did all other commands), I'll remove this ASAP, it is clearly a bug.
5 { 'a' 'b' } is not supposed to store 5 in 'a' and 5 in 'b'!
It's supposed to store 5 in variable 'b' inside subdirectory 'a' (lists are paths), which is what it correctly did until I enabled parallel processing. Another regression to fix.

I usually use this syntax 5 {'a' 'b'} STO to store 5 in a and b with stock HP50g. I'm not sure STO should work the way you describe or perhaps I missed something or misunterstand what you wrote.
Find all posts by this user
Quote this message in a reply
10-26-2017, 10:32 PM
Post: #210
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
(10-26-2017 09:23 PM)Gilles59 Wrote:  
(10-26-2017 08:43 PM)Claudio L. Wrote:  Regarding the bug in STO: Somehow I enabled parallel processing for STO (when I did all other commands), I'll remove this ASAP, it is clearly a bug.
5 { 'a' 'b' } is not supposed to store 5 in 'a' and 5 in 'b'!
It's supposed to store 5 in variable 'b' inside subdirectory 'a' (lists are paths), which is what it correctly did until I enabled parallel processing. Another regression to fix.

I usually use this syntax 5 {'a' 'b'} STO to store 5 in a and b with stock HP50g. I'm not sure STO should work the way you describe or perhaps I missed something or misunterstand what you wrote.

Wow, you are absolutely right. I was convinced STO and RCL supported the use of paths instead of just identifiers. I had to take my other 50g with stock rom to test that.
I guess that's why I disabled it, it's a compatibility issue. I guess all I have to do then is to make sure the empty list is dropped. I can fix that. Thanks for the head-up!
Find all posts by this user
Quote this message in a reply
10-26-2017, 10:38 PM (This post was last modified: 10-26-2017 10:43 PM by Gilles59.)
Post: #211
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
(10-26-2017 10:32 PM)Claudio L. Wrote:  
(10-26-2017 09:23 PM)Gilles59 Wrote:  I usually use this syntax 5 {'a' 'b'} STO to store 5 in a and b with stock HP50g. I'm not sure STO should work the way you describe or perhaps I missed something or misunterstand what you wrote.

Wow, you are absolutely right. I was convinced STO and RCL supported the use of paths instead of just identifiers. I had to take my other 50g with stock rom to test that.
I guess that's why I disabled it, it's a compatibility issue. I guess all I have to do then is to make sure the empty list is dropped. I can fix that. Thanks for the head-up!

RCL and STO dont work in the same way for this. RCL support the use of Path. I just look the AUR. Path for RCL are describe. Nothing is explain about STO nor in STO description or parallel processing chapter. But I use these syntax from long time ago ;D

5 {'a' 'b'} STO
{1 2 3} {'One' 'Two' 'Three' } STO
Find all posts by this user
Quote this message in a reply
10-26-2017, 10:55 PM
Post: #212
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
(10-26-2017 05:36 PM)The Shadow Wrote:  Here's an example of a newRPL program, a version of VISIT, that I haven't figured out how to do properly without changing a list into a program. If anyone can suggest a more efficient way I've missed, I'd welcome it:

<< DUP RCL IF DUP TYPE 28 == THEN DROP2 ELSE SWAP OVER "VISITBKUP" SDSTO { "EN" DELKEY STOXP } ADD LXP "EN" 0 ASNKEY "DN" KEYEVAL END >>

STOXP stands for STOre with eXtreme Prejudice, and will STO into a variable even if it is locked.

LXP is a name in the same spirit as AXL. It changes lists to programs and vice versa.

The only annoyance in this version of VISIT is that it seems to get the timing wrong at times, exiting the editor without having done DELKEY, leaving the edited object on the stack. If you press Enter again immediately, this will then store it properly. If you don't, you're asking for trouble, which is why I took the trouble of storing a backup on the SD card.

Likewise, if you exit the editor with ON, you'll have to press Enter immediately. It seems one can't add user keys to ON, which is probably wise, though unfortunate in this instance.

How about this way?
<< DUP RCL IF DUP TYPE 28 == THEN DROP2 ELSE SWAP OVER "VISITBKUP" SDSTO '.VisitVAR' STO '.VisitVAR' HIDEVAR << "EN" DELKEY IFERR '.VisitVAR RCL THEN ELSE STOXP '.VisitVAR' PURGE END >> "EN" 0 ASNKEY "DN" KEYEVAL END >>

And the proper way: just wait until I implement it! This really belongs in a built-in library.
Also, your program should create its own context, and replace the Enter key only inside that context, when the editor is active to avoid any interference with normal operation. Of course, there's still no commands to create your own context or change to it. Patience...
As you said, too many quirks for the time being.
Find all posts by this user
Quote this message in a reply
10-27-2017, 12:59 AM
Post: #213
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
(10-26-2017 09:05 PM)Gilles59 Wrote:  Hi,

Here is a program to find the numbers that are equal to the sum of the cubes of their digits

New RPL Version :
Code:
«
0 9 FOR 'a'
 0 9 FOR 'b'
  0 9 FOR 'c'
   IF 'a*100+b*10+c==a^3+b^3+c^3' THEN {a b c } EVAL END
  NEXT
 NEXT
NEXT
»
TEVAL : 1,06 sec

UserRPL version
Code:

«
0. 9. FOR a
 0. 9. FOR b
  0. 9. FOR c
   IF 'a*100.+b*10.+c==a^3.+b^3.+c^3.' THEN a b c 3. ->LIST END
  NEXT
 NEXT
NEXT
»
TEVAL : 289 sec (slow both in real or exact)

An other way en NewRPL :
Code:
<< 0 999 FOR 'n' n DUP ->STR UTF8-> #30h - 3 ^ ΣLIST == n IFT NEXT >>
TEVAL : 1,56"

UserRPL with GoferList lib (exact mode only):
Code:
 0 999 1 Seq « DUP ->STR Chars STR-> 3 ^ Sum ==  » Filter
TEVAL : who cares ? ;D
EDIT : Surprisingly, faster than previous UserRPL in 201 sec.

UserRPL with DavidM's ListExt library:

Code:
\<< 0. 999. FOR n
n DUP I\->NL 3. ^ LSUM SAME n IFT
            NEXT
\>>

TEVAL: 86.6 sec.
Find all posts by this user
Quote this message in a reply
10-27-2017, 06:32 PM
Post: #214
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
(10-26-2017 09:07 PM)okkama Wrote:  How do i enter a mixed numbers(1+2/3)? Only as well as HP 50G?
http://www.hpmuseum.org/forum/thread-187...l#pid16759
Quote:I think using double dots would be quick to type:
'3/4' would be 3..4
'1+2/3' would be 1..2..3

That was never implemented, since we abused of the dot for other things. Still not entirely discarded, though, just not a priority at this moment.
Find all posts by this user
Quote this message in a reply
10-27-2017, 06:36 PM
Post: #215
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
(10-26-2017 09:05 PM)Gilles59 Wrote:  An other way en NewRPL :
Code:
<< 0 999 FOR 'n' n DUP ->STR UTF8-> #30h - 3 ^ ΣLIST == n IFT NEXT >>
TEVAL : 1,56"

Better version for newRPL:
Code:

<< 0 999 FOR 'n' 
 n 0 0  DIGITS 3 ^
 n 1 1  DIGITS 3 ^ +
 n 2 2  DIGITS 3 ^ +
 n ==
 n IFT
 NEXT
 >>
TEVAL = 0.57 sec.
Find all posts by this user
Quote this message in a reply
10-27-2017, 10:08 PM (This post was last modified: 10-27-2017 10:09 PM by Gilles59.)
Post: #216
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
(10-27-2017 12:59 AM)John Keith Wrote:  
Code:
\<< 0. 999. FOR n
n DUP I\->NL 3. ^ LSUM SAME n IFT
            NEXT
\>>

TEVAL: 86.6 sec.

This one use both ListEx and GolferList with UserRPL. Little slower but I like it :
Code:
 0. 999. LSEQ + << DUP I->NL 3. ^ LSUM SAME >> Filter
96" and return a list
Find all posts by this user
Quote this message in a reply
10-28-2017, 12:03 AM
Post: #217
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
(10-27-2017 10:08 PM)Gilles59 Wrote:  
(10-27-2017 12:59 AM)John Keith Wrote:  
Code:
\<< 0. 999. FOR n
n DUP I\->NL 3. ^ LSUM SAME n IFT
            NEXT
\>>

TEVAL: 86.6 sec.

This one use both ListEx and GolferList with UserRPL. Little slower but I like it :
Code:
 0. 999. LSEQ + << DUP I->NL 3. ^ LSUM SAME >> Filter
96" and return a list

"0. 999. LSEQR" would allow you to drop the "+". I agree with Gilles that returning the results as a list is nice. Both LSEQ and LSEQR will be even faster in the final release (probably next week), especially with exact integers. That's not the slow spot for this program, though.

The newRPL version clearly shows that there's plenty of life left in the 50g! That's great to see, Claudio.
Find all posts by this user
Quote this message in a reply
10-28-2017, 03:36 AM
Post: #218
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
(10-26-2017 10:38 PM)Gilles59 Wrote:  RCL and STO dont work in the same way for this. RCL support the use of Path. I just look the AUR. Path for RCL are describe. Nothing is explain about STO nor in STO description or parallel processing chapter. But I use these syntax from long time ago ;D

5 {'a' 'b'} STO
{1 2 3} {'One' 'Two' 'Three' } STO

I think that difference between RCL and STO threw me off, I thought they were consistent. In any case, I think I came up with a decent compromise:
* Both STO and RCL will have parallel processing (still have to fix the empty list annoyance, but that's easy).
* Both STO and RCL will accept absolute paths using list of lists (double brackets).

For example:
5 { 'a' 'b' } STO will store 5 in 'a' and 'b'
5 {{ 'a' 'b' }} STO will store 5 into variable 'a' within subdirectory 'b' inside the current directory.
{ 'X' 'Y' 'Z' } RCL will return { 1 2 3 } assuming X=1, Y=2, Z=3. This is consistent with the normal use of commands and operators on lists.
'X' RCL will do the usual: find X in the current or parent dirs
{{ 'X' }} RCL will only find 'X' in the current dir but not the parent dirs (since this is now an explicit path to the current directory)
{{ 'MYDIR' 'X' }} RCL will get 'X' from directory 'MYDIR' inside of the current directory.

By the way, paths can use both HOME and UPDIR anywhere, so:
{{ UPDIR 'MYDIR' 'X' }} RCL will search for 'X' in directory 'MYDIR' inside the parent of the current directory.
Find all posts by this user
Quote this message in a reply
10-29-2017, 10:11 AM (This post was last modified: 10-29-2017 10:23 AM by Gilles59.)
Post: #219
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
(10-28-2017 03:36 AM)Claudio L. Wrote:  I think that difference between RCL and STO threw me off, I thought they were consistent. In any case, I think I came up with a decent compromise(...)

I like this...

There is another functionality (i dont know if this is documented and dont remind where I saw this the first time) that I use often with stock HP50G and could be interesting in NewRPL. It'a a kind of 'auto-evaluated' algebraic expression like this : `Algebraic`. For example :

`m*g/(√ ((2*m*g)/(c*p*s))`
is equivalent to
'm*g/(√((2*m*g)/(c*p*s))' EVAL

To get `` on a stock HP50g : RShift hold '

I also notice that the algebraic syntax 'L(n)' dont work in new RPL. Ex :

{11 12 13 14 } 'L' STO
'L(3)' EVAL ( or `L(3)` ) returns 13
99 'L(3)' STO
change L in { 11 12 99 14 }

[[ 1 2] [3 4]] 'M' STO
`M(2,2)` returns 4
If a and b are 2, `M(a,b)` returns 4
99 'M(a,b)' STO change M in [[ 1 2] [3 99]]

Imo this allows much more readibility in certain programs with a lot of algebraic expressions or tables (list or matrice), or with GET PUT instructions.



``
Find all posts by this user
Quote this message in a reply
10-30-2017, 01:16 PM
Post: #220
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
(10-29-2017 10:11 AM)Gilles59 Wrote:  
(10-28-2017 03:36 AM)Claudio L. Wrote:  I think that difference between RCL and STO threw me off, I thought they were consistent. In any case, I think I came up with a decent compromise(...)

I like this...

There is another functionality (i dont know if this is documented and dont remind where I saw this the first time) that I use often with stock HP50G and could be interesting in NewRPL. It'a a kind of 'auto-evaluated' algebraic expression like this : `Algebraic`. For example :

`m*g/(√ ((2*m*g)/(c*p*s))`
is equivalent to
'm*g/(√((2*m*g)/(c*p*s))' EVAL

To get `` on a stock HP50g : RShift hold '

I also notice that the algebraic syntax 'L(n)' dont work in new RPL. Ex :

{11 12 13 14 } 'L' STO
'L(3)' EVAL ( or `L(3)` ) returns 13
99 'L(3)' STO
change L in { 11 12 99 14 }

[[ 1 2] [3 4]] 'M' STO
`M(2,2)` returns 4
If a and b are 2, `M(a,b)` returns 4
99 'M(a,b)' STO change M in [[ 1 2] [3 99]]

Imo this allows much more readibility in certain programs with a lot of algebraic expressions or tables (list or matrice), or with GET PUT instructions.



``

The backtick behavior in RPL is only a side effect of the algebraic mode (everything you enter in algebraic mode uses that backtick to EVAL directly as soon as you enter it). I don't discard implementing it eventually.
Indexing in algebraic expressions will be implemented, the only reason it wasn't implemented yet is the matrix module was very green (incomplete), but I'm working on that currently, so this would be next in line. I agree in the readability of the notation versus PUT/GET commands (although it may not be considered pure RPL)
Find all posts by this user
Quote this message in a reply
Post Reply 




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