[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alternatives to for loops in PlusCal



I see. I want the change to be an atomic action, so I will keep what I have. Thank you!

But, just to understand, how could I split this up in PlusCal and keep it non-atomic?

btw, the ballots is a function of a function. I am trying to update an array element within an array.

On Thursday, September 27, 2018 at 8:29:03 AM UTC-4, Balaji Arun wrote:
Hi,

I am trying to perform the following operation in PlusCal

\* list = {o1, o2}
ballots
' = [obj \in Objects |->
                    IF obj \in list
                    THEN [ballots[o] EXCEPT ![a] = obal]
                    ELSE ballots[obj]]

ballots is a function, and I only want to modify part of the function indicated by the list set.
In programming, I can accomplish with a for loop, but PlusCal doesn't have one.

Any ideas?