We have a little tradition of drawing decorations and coloring them in for Halloween. This year, my six year old took measures into her own hands for Thanksgiving.... Perhaps she'll write horror movies one day.
Last Sunday I had the chance to go to the Wyoming Downs. I’ve never been to a horse race before. My only experience was that of dramatized scenes in movies. It was quite interesting to see how accurate horse racing’s depiction in movies really is.
Besides getting a bit sunburned, I had a great time. Luckily I went with a friend that could give me a quick tutorial on how to place bets. Once I got the basics down, it became quite easy. Most bets are really straight forward. It was really interesting to see how even the best horses could get out run. When an unexpected horse wins people often lose big or win really big.
No matter how much analyzing one does, the element of chance is still the primary driving force in every race. Long shots are possible.
As long as you are careful, and bet modestly, the level of fun and entertainment will always outstrip the losses you will have. I highly suggest a trip to the races to everyone, and bring your family too.
Working on an AES implementation in ruby, I’ve had many occasion to do:
n.times {|i| some calculations based on i}
I’m sure many of you have used the Integer#times method much to your glee. I’m sure many of you have also had the occasion where you realize that you want those resultant calculations to end up in an array of some sort. At this point you have two options: create an array before hand and << those results in, or change your iterator to (0...n).map {|i| ...}. Both options are severely lacking in taste, IMO. So I came up with a third option. Enter Integer#things.
ary = n.things {|i| ...}
Notice how the syntax here remains consistent with the semantics. Before you wanted to do something n times. Here you want the same, but you want to store the results, you want n results, or n things.
Don’t get me wrong, I love Range and it certainly has it’s place. I would never argue that 26.things { make a letter } is a better approach than ('a'..'z') { just have your letter already }. Like I said, it’s about semantics, do you really want that range or is it more about the number of things? And as we all know deep down, the syntactics should match the semantics wherever possible.
So here is my implementation for Integer#things and I really hope something like this becomes included in future ruby.
class Integer
def things &b
b ||= proc {|i| i}
ary = []
times do |i|
ary << yield(i)
end
ary
end
end
0 comments
We've got a little one on the way, due Dec 4. My wife is running a pool on the statistics, like color and size, etc. If you know us well enough to make an educated guess (or you just fancy yourself a comedian), join in the fun!
First: an apology. I have several articles in the works, but none that I've had the time and concentration to bring to fruition and post. So this is a simple non-sequitor. Back in the day when Mike and I shared an office, we tried to lighten the effects of stressful duties by taking time now and then for chess (taking a break from thinking to do other thinking - a lot of people didn't get this
via mindjuju in #uphpu on chat.freenode.net
While I generally detest re-publishing crap everyone has seen already, this video is different. It is a critical piece of education for any male (or person assuming to be male). Never, ever, talk in the restroom.






