Section with Julia exercises, contests and equivalences with other languages

I think it would be a good a idea to have a category on the forum with:

  • A collection of typical tasks solved with Julia.
  • A daily or weekly contest where somebody raise an exercise or problem and others post their solution. It can have two categories, simple ones to learn, and another with the fastest, shortest or more original solution.
  • A thread or interactive sheet to add typical R, Python or Matlab instructions and its equivalent Julia ones. I know there are already some collections, but we could collect and improve them.

Um, more or less everything? Julia is used for diverse problems, ranging from natural language processing to astrophysics.

This is more or less happening every 30 minutes on average (depending on time of the day). We just don’t treat it as a contest, which I think is better.

See the manual for an overview. Doing something more detailed is an option, but has the downside the the important things get lost in the noise.

1 Like

I understand what you say but I mean to put some of those things on an specific thread organized as a collection of exercises, problems, contests, summaries…

And I’m not speaking about natural language processing or astrophysics problems, just simple problems, though some of first could be used as an example.

For example once I needed an efficient ways to reshape huge data from long to wide format using R and data.table:

And I got this answer from Uwe, the usual methods consumes too much memory.

setDT(mydata)

# add unique row number to join on later 
# (leave `ID` col as placeholder for all other id.vars)
mydata[, rn := seq_len(.N)]

# define columns to be reshaped
measure_cols <- stringr::str_subset(names(mydata), "_\\d$")

# melt with only one id.vars column
molten <- melt(mydata, id.vars = "rn", measure.vars = measure_cols)

# split column names of measure.vars
# Note that "variable" is reused to save memory 
molten[, c("variable", "measure") := tstrsplit(variable, "_")]

# coerce names to factors in the same order as the columns appeared in mydata
molten[, variable := forcats::fct_inorder(variable)]

# remove columns no longer needed in mydata _before_ joining to save memory
mydata[, (measure_cols) := NULL]

# final dcast and right join
result <- mydata[dcast(molten, ... ~ variable), on = "rn"]
result

It would be great to have a collection of similar things for Julia.

1 Like

Something like the “Python Cookbook”. Yeah, that would be nice.

See Rosetta Code.