• Help with sysRPL

    From Arnaud Amiel@21:1/5 to All on Mon Apr 8 01:17:18 2019
    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
    %%/
    ;
    @

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hic quondam locutus sum@21:1/5 to Arnaud Amiel on Mon Apr 8 12:59:19 2019
    On Mon, 8 Apr 2019 01:17:18 -0700 (PDT), Arnaud Amiel <aamiel@gmail.com> wrote:

    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" )

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arnaud Amiel@21:1/5 to All on Tue Apr 9 00:37:55 2019
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hic quondam locutus sum@21:1/5 to Arnaud Amiel on Tue Apr 9 13:45:31 2019
    On Tue, 9 Apr 2019 00:37:55 -0700 (PDT), Arnaud Amiel <aamiel@gmail.com> wrote:

    Thanks,

    No problem :)

    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.


    Thanks for your help,

    Arnaud

    You're welcome :)

    Regards,

    Hic quondam locutus sum

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)