June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 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