Discussion:
Help with sysRPL
(too old to reply)
Arnaud Amiel
2019-04-08 08:17:18 UTC
Permalink
I used to be good at this but this was many years ago.
I have now dusted off my emulator and try to do the thing below.

It is not optimised in any way and doesn't work.

It looks like the NULLLAMs are not available inside the DO loop. There is something in the back of my mind that tells me "you should know why" but it has been a good 10? years.

Any pointers appreciated

Arnaud

!NO CODE
!RPL
::
DUPDUP
%%*
%%1
%%+
%%2
%%/
3UNROLL
%%1
%%+
%%2
%%/
%%1
%%1
4NULLLAM{}
BIND
DO
1GETLAM
4GETLAM
%%-
%%2
%%/
DUP
2GETLAM
%%*
%%*
%%-
1GETLAM
4GETLAM
%%*
%%SQRT
4PUTLAM
2GETLAM
%%2
%%*
2PUTLAM
3GETLAM
DUPDUP
1PUTLAM
4GETLAM
%%+
%%2
%%/
DUP
3PUTLAM
%%-
%%0=
UNTIL
1GETABND
%%/
;
@
Hic quondam locutus sum
2019-04-08 17:59:19 UTC
Permalink
Post by Arnaud Amiel
I used to be good at this but this was many years ago.
I have now dusted off my emulator and try to do the thing below.
It is not optimised in any way and doesn't work.
It looks like the NULLLAMs are not available inside the DO loop. There is something in the back of my mind that tells me "you should know why" but it has been a good 10? years.
Any pointers appreciated
Arnaud
!NO CODE
!RPL
DUPDUP
%%*
%%1
%%+
%%2
%%/
3UNROLL
%%1
%%+
%%2
%%/
%%1
%%1
4NULLLAM{}
BIND
DO
1GETLAM
4GETLAM
%%-
%%2
%%/
DUP
2GETLAM
%%*
%%*
%%-
1GETLAM
4GETLAM
%%*
%%SQRT
4PUTLAM
2GETLAM
%%2
%%*
2PUTLAM
3GETLAM
DUPDUP
1PUTLAM
4GETLAM
%%+
%%2
%%/
DUP
3PUTLAM
%%-
%%0=
UNTIL
1GETABND
%%/
;
@
It looks like you've mixed up a DO .. LOOP with a BEGIN .. UNTIL loop :)
Replacing "DO" with "BEGIN" should fix the problem :). BEGIN and UNTIL are RPL
words that can stand on their own, although I've come across very few examples
where one would need that -- they're usually paired :) .

I'm surprised that the compiler didn't issue an error or a warning :)

Regards,

Hic quondam locutus sum

--------------------------------------------------------------------------------

Send e-mails to "NOhp48 Sat Palephnaught Adot Morg"

( Remove the capitalized letters spelling "NOSPAM" )
Arnaud Amiel
2019-04-09 07:37:55 UTC
Permalink
Thanks, as I said, I am a bit (very) rusty. Working fine now. I should go back and check the books.

Thanks for your help,

Arnaud
Hic quondam locutus sum
2019-04-09 18:45:31 UTC
Permalink
Post by Arnaud Amiel
Thanks,
No problem :)
Post by Arnaud Amiel
Working fine now.
That's good to hear :) Note that your uncorrected code, fortunately, would only
create a memory leak with an orphan DO-LOOP environment and possibly pop an
address off of the RPL return stack, which would just exit the parent secondary.
Post by Arnaud Amiel
Thanks for your help,
Arnaud
You're welcome :)

Regards,

Hic quondam locutus sum

Loading...