Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/Nth/Stata/nth.stata
Normal file
18
Task/Nth/Stata/nth.stata
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
mata
|
||||
function maps(f,a) {
|
||||
nr = rows(a)
|
||||
nc = cols(a)
|
||||
b = J(nr,nc,"")
|
||||
for (i=1;i<=nr;i++) {
|
||||
for (j=1;j<=nc;j++) b[i,j] = (*f)(a[i,j])
|
||||
}
|
||||
return(b)
|
||||
}
|
||||
|
||||
function nth(n) {
|
||||
k = max((min((mod(n-1,10)+1,4)),4*(mod(n-10,100)<10)))
|
||||
return(strofreal(n)+("st","nd","rd","th")[k])
|
||||
}
|
||||
|
||||
maps(&nth(),((0::25),(250::275),(1000::1025)))
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue