Difference between revisions of "Array.branch()"

From ZCubes Wiki
Jump to navigation Jump to search
(Created page with " * << Z3 Home * Z3 Language Documentation * Z%5E3_Array_Manipulation_Member_Functions | Listing of Z3 Array Manipulation Member...")
 
 
(3 intermediate revisions by 2 users not shown)
Line 4: Line 4:
 
*[[ Z%5E3_Array_Manipulation_Member_Functions | Listing of Z3 Array Manipulation Member Functions]]
 
*[[ Z%5E3_Array_Manipulation_Member_Functions | Listing of Z3 Array Manipulation Member Functions]]
  
 +
==Array.branch(fns)==
  
==Array.branch(SomeOnlyMatches)==
+
fns can be any arbitrary array of functions. The result will be a similar array as functions evaluated for the array itself.
  
Split values into negative, zero and positive values. Return the true/false of the match result. Show all (with null for non-matches) or matches only based on SomeOnlyMatches.  
+
Split values into [negative, zero and positive] values by default. Returns the true/false of the match result.  
  
[[1,-2],[3,3],[0,44,-44]].branch(true)
+
 
 +
[[1,-2],[3,3],[0,44,-44]].branch(true).print()
 +
 
 +
[
 +
[
 +
[false,true ],
 +
 +
[false,false ],
 +
 +
[false,false,true ]
 +
],
 +
 
 +
[
 +
[false,false ],
 +
 +
[false,false ],
 +
 +
[true,false,false ]
 +
],
 +
 
 +
[
 +
[true,false ],
 +
 +
[true,true ],
 +
 +
[false,true,false ]
 +
]
 +
]
 +
 
 +
 
 +
[-5..5].branch(true)
 +
 
 +
true true true true true false false false false false false
 +
 
 +
false false false false false true false false false false false
 +
 
 +
false false false false false false true true true true true
 +
 
 +
 
 +
[-5..5].branchvalues(true)
 +
 
 +
branchvalues splits it based on neg, zero and positive, and OnlyMatches will filtered if unmatched.
 +
 
 +
-5 -4 -3 -2 -1
 +
 
 +
0
 +
 
 +
1 2 3 4 5
 +
 
 +
 
 +
-10..10.branch([LT,[EQ,GT]]) .print()
 +
 
 +
==See Also==
 +
[[Array.branchvalues() | branchvalues]]

Latest revision as of 21:47, 21 March 2024

Array.branch(fns)

fns can be any arbitrary array of functions. The result will be a similar array as functions evaluated for the array itself.

Split values into [negative, zero and positive] values by default. Returns the true/false of the match result.


[[1,-2],[3,3],[0,44,-44]].branch(true).print()

[ [ [false,true ],

[false,false ],

[false,false,true ] ],

[ [false,false ],

[false,false ],

[true,false,false ] ],

[ [true,false ],

[true,true ],

[false,true,false ] ] ]


[-5..5].branch(true)

true true true true true false false false false false false

false false false false false true false false false false false

false false false false false false true true true true true


[-5..5].branchvalues(true)

branchvalues splits it based on neg, zero and positive, and OnlyMatches will filtered if unmatched.

-5 -4 -3 -2 -1

0

1 2 3 4 5


-10..10.branch([LT,[EQ,GT]]) .print()

See Also

branchvalues