Tagged: Uncategorized

A generalised FizzBuzz solution in R ;-)

Just spotted this and wondered if I could come up with a pretty solution in R. Here’s an attempt.

fizzbuzz = function(i, multiples = c(3,5), text = c("Fizz", "Buzz")) {
  words = text[i %% multiples == 0]
  if (length(words) == 0)
    as.character(i)
  else
    paste(words, collapse = "")
}

sapply(1:200,function(x) fizzbuzz(x))

This also generalises, e.g., call

sapply(1:200,function(x) fizzbuzz(x, c(3,5,7), c("Fizz","Buzz","Bang")))
Advertisements

Trish Keenan: Mind Bending Motorway mix

From a friend of Trish’s, spotted over here:

“Before she went to Australia Trish sent me a mix CD of bonkers pop music she compiled, I never thanked her. Its called Mind Bending Motorway Mix and I want to share it with you, please pass the link on, share it far and wide, its a little tribute to an (as a friend referred to her today) exhilarating woman…”

Trish Keenan :: Mind Bending Motorway mix / mediafire link

Mao Tse-tung on the psychology of problem solving and the empirical method

“You can’t solve a problem? Well, get down and investigate the present facts and its past history! When you have investigated the problem thoroughly, you will know how to solve it. Conclusions invariably come after investigation, and not before. Only a blockhead cudgels his brains on his own, or together with a group, to “find a solution” or “evolve an idea” without making any investigation. It must be stressed that this cannot possibly lead to any effective solution or any good idea.”

—Oppose Book Worship (May 1930)

:-)

Things I Learned in Greece

  • Freddo metrios are very nice. (Iced cappuccino with a medium amount of sugar.)
  • Political debates on the telly are hilarious, even with no knowledge of Greek. Participants shout in parallel, sometimes with the screen split in two or three so you can match lips to words.
  • Young children are given puzzles about anaphoric reference.
  • A phone conversation is about to end when you hear: “nai, nai… en daxi… daxi…. daxi… ella… ya.”
  • You’re supposed to put used toilet roll in the bin, not flush it. (Thankfully I was informed of this before demolishing my host’s plumbing.)

There was other historical stuff there, too, apparently.