Post Reply 
Plus42 Equations, Preview Release
05-16-2022, 10:36 PM (This post was last modified: 05-16-2022 11:12 PM by Thomas Okken.)
Post: #666
RE: Plus42 Equations, Preview Release
(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.
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 - Thomas Okken - 05-16-2022 10:36 PM



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