Quiz 1.8: Functions
Q1: Function comparison
Given the following code snippet:
function foo(x)
list = []
for i in 2:x
cond = true
for j in list
if i%j == 0
cond = false
end
end
if cond push!(list,i); end
end
return list
end
function foo2(x)
if x == 1 return []; end
ns = foo2(x-1)
cond = true
for i in ns
if x%i == 0
cond = false
end
end
if cond push!(ns,x); end
return ns
endWhich of the following sentences are correct ?