Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,2 @@
put median("4.1,5.6,7.2,1.7,9.3,4.4,3.2") & "," & median("4.1,7.2,1.7,9.3,4.4,3.2")
returns 4.4, 4.25

View file

@ -0,0 +1,24 @@
function floor n
if n < 0 then
return (trunc(n) - 1)
else
return trunc(n)
end if
end floor
function median2 x
local n, m
set itemdelimiter to comma
sort items of x ascending numeric
put the number of items of x into n
put floor(n / 2) into m
if n mod 2 is 0 then
return (item m of x + item (m + 1) of x) / 2
else
return item (m + 1) of x
end if
end median2
returns the same as the built-in median, viz.
put median2("4.1,5.6,7.2,1.7,9.3,4.4,3.2") & "," & median2("4.1,7.2,1.7,9.3,4.4,3.2")
4.4,4.25