Skip to content

Instantly share code, notes, and snippets.

@robertfeldt
Last active April 12, 2016 14:30
Show Gist options
  • Save robertfeldt/fdbb5d02e508bb42a3250dd4fab5d406 to your computer and use it in GitHub Desktop.
Save robertfeldt/fdbb5d02e508bb42a3250dd4fab5d406 to your computer and use it in GitHub Desktop.
# Num authors in accepted (?) ICST papers according to the PC chairs intro presentation:
numauthors = [
(:usa, 82),
(:china, 58),
(:germany, 37),
(:sweden, 29),
(:japan, 21),
(:brazil, 17),
(:france, 17)]
# Population in these countries on April 12th 2016 according to worldometers.com, same order as above
population = [
323612265,
1380969591,
80683685,
9836208,
126377465,
209196201,
64609282
]
# Zip them up
t = collect(zip(numauthors, population))
# Calc the num citizens per ICST authors
u = map(t -> (t[1][1], t[2]/t[1][2]), t)
# Sort and round to k or M
v = sort(u, by = t -> t[2])
round_k_or_M(cpa) = cpa > 1e6 ? (string(round(cpa/1e6, 1)) * "M") : (string(round(cpa/1e3, 1)) * "k")
result = map(t -> (t[1], round_k_or_M(t[2])), v)
@show result
# result = [(:sweden,"339.2k"),(:germany,"2.2M"),(:france,"3.8M"),(:usa,"3.9M"),(:japan,"6.0M"),(:brazil,"12.3M"),(:china,"23.8M")]
# 7-element Array{Tuple{Symbol,ASCIIString},1}:
# (:sweden,"339.2k")
# (:germany,"2.2M")
# (:france,"3.8M")
# (:usa,"3.9M")
# (:japan,"6.0M")
# (:brazil,"12.3M")
# (:china,"23.8M")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment