-
-
January 11, 2025 at 8:06 amfdtsaidSubscriberIn
Scade Language Reference 8.5 Operator Application and Higher-Order Patterns
, it illustrated that the usage offoldw
:idx, acc = (foldw op << size >> if cond0)(acc0, A1,...,An)is equivalent to particular form ofmapfoldw
:idx, _, acc = (mapfoldw 1 op << size >> if cond0)(acc0, A1, ..., An)Should it be the following form instead?idx, _, acc = (mapfoldw 1 op << size >> if cond0 default ())(acc0, A1, ..., An)Because the syntax definition ofmapfoldw
isoperator ::= (iterator_mw operator << size >> if expr default expr)iterator_mw ::= mapfoldw [[ INTEGER ]] -
January 13, 2025 at 9:54 amBenjamin DescorpsAnsys Employee
Hello,
You're correct. The right syntax is
idx, _, acc = (mapfoldw 1 op <
> if cond0 default ()) (acc0, A1,…,An) Let's have the following example:
const n : uint8 = 10;function Op (c,d: bool) returns (cond_o, s: bool)lets = c or d;cond_o = not s;telfunction disjunction(B: bool^n) returns (exist: bool; i: bool)i, exist = (foldw Op <> if true) (false, B); The foldw could be replaced by the mapfoldw in the following way:i, _, exist = (mapfoldw 1 Op <> if true default ())(false, B); Regards,Benjamin
-
Viewing 1 reply thread
- You must be logged in to reply to this topic.
Ansys Innovation Space
Trending discussions
Top Contributors
-
1406
-
599
-
591
-
555
-
366
Top Rated Tags
© 2025 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.