Post Reply 
Plus42 Equations, Preview Release
05-17-2022, 04:00 AM (This post was last modified: 05-17-2022 04:02 AM by Eddie W. Shore.)
Post: #668
RE: Plus42 Equations, Preview Release
(05-16-2022 10:36 PM)Thomas Okken Wrote:  
(05-16-2022 01:28 PM)Eddie W. Shore Wrote:  S=FOR(L(A:0):G(I)≤4:L(I:G(I)+1):L(A:G(A)+G(I)))

This is missing the initialization of I. You could use SEQ to combine it with the initialization of A:

S=FOR(SEQ(L(A:0):L(I:0)):G(I)≤4:L(I:G(I)+1):L(A:G(A)+G(I)))

(05-16-2022 01:28 PM)Eddie W. Shore Wrote:  Something that threw me off is that the order of NEXT and EXPR, which the EXPR (which I think there could be more than one EXPR statements), I am used to NEXT either at the end of the FOR loop or implied (end of indentation in Python, for example).

The Plus42 FOR is modeled after the one in C:

    FOR(INIT:COND:NEXT:EXPR:...)

corresponds to

    for (init; cond; next) {
        expr;
        ...
    }


Note that NEXT is different from the expressions making up the loop body EXPR:..., in that NEXT is executed even if the loop body is cut short by CONTINUE.

I forgot the initialization of I.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Plus42 Equations, Preview Release - Eddie W. Shore - 05-17-2022 04:00 AM



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