Re: product() unexpected result

new topic     » goto parent     » topic index » view thread      » older message » newer message

yup,

? product( {} ) 

0 

On this side of the pond, everything is backwards?


 
global function Product(object a) 
atom res = 0 
    if atom(a) then 
        res = a 
    elsif length(a) then 
        res = 1 
        for i=1 to length(a) do 
            res *= product(a[i]) 
        end for 
    end if 
    return res 
end function 
 
? Product( {} ) 

0 


The concrete example was a bit stretched, but in context of my local city contracts it makes a lot of sense.

''Math'' thinking suits me better.

be well
_tom

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu