1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-15 11:54:02 +02:00

Documented xor() function.

This commit is contained in:
Chris Palmer
2021-04-02 19:28:49 +01:00
parent c073419c0b
commit f3376edaf1
3 changed files with 6 additions and 1 deletions

View File

@@ -160,4 +160,5 @@ function mapi(v, func) = [ for (i = [0:len(v)-1]) func(i,v[i]) ]; //! make a new
function reduce(v, func, unity) = let ( r = function(i,val) i == len(v) ? val : r(i + 1, func(val, v[i])) ) r(0, unity); //! reduce a vector v to a single entity by applying the func function recursively to the reduced value so far and the next element, starting with unity as the initial reduced value
function sumv(v) = reduce(v, function(a, b) a + b, 0); //! sum a vector of values that can be added with "+"
function xor(a,b) = (a && !b) || (!a && b);
function xor(a,b) = (a && !b) || (!a && b); //! Logical exclusive OR
function cuberoot(x)= sign(x)*abs(x)^(1/3);