He was one of the coolest dudes around. Don’t take my word for it, see for yourself.
Really the point of this post is to test if I can embed youtube in my blog, which I can, so you will be getting a lot of random crap from now on.
He was one of the coolest dudes around. Don’t take my word for it, see for yourself.
Really the point of this post is to test if I can embed youtube in my blog, which I can, so you will be getting a lot of random crap from now on.
Now for a real post in a very cool language that is on the rise. Currently my favorite language to write, Ruby.
Simple PowerSet implementation, pretty straight-forward.
class Array
def powerSet!
return [[]] if empty?()
f = shift()
rec = powerSet!
return rec + rec.collect {|i| [f] + i }
end
def powerSet
return clone().powerSet!
end
end
Note, I added this directly to the Array class. In ruby, classes are left open, so you can add to them later. It is a very dynamic language, and there are hooks for just about everything, so you could have some behavior run when a method is added to your class. Now that Array has a new method, you can just call
[1,2,3].powerSet
Now let’s write it using inject, because inject is awesome. (inject is known as reduce in python, and they are removing it from the next version. It’s a shame they are removing it, but it makes sense because python doesn’t sweet sweet blocks like ruby.)
array = [1,2,3]
array.inject([[]]) { |acc, you|
ret = []
acc.each { |i|
ret << i
ret << i + [you]
}
ret
}
The best part about inject is that once you get your head around it, it is pretty clear and also that this expression can be smashed to 50 chars if that is what gets you going.
[1,2,3].inject([[]]){|c,y|r=[];c.each{|i|r<<i;r<<i+[y]};r}
I am now the coolest John Carrino. All the search engines say so. Even the crappy ones. Bam!
Look! It’s a Lemur.
Yippie. I finally got a domain after missing out on all the good carrino-dot domains. I even missed johncarrino.com.
Originally, I was too cheap to buy dns hosting, so I just had the park page redirect to my 2nd level domain from dyndns, carrino.myphotos.cc. I finally got dns for free from dennis and it works great.
Also, I made this blog my redirect from / instead of gallery. That is probably how you got to this horrible thing. If you need to get away, the gallery, is always there.
And in summary, here are some pictures from my vacation last week.
So my parents visited my place beginning last wednesday and staying for 10 days through yesterday. We had a pretty good time hitting up all the things to see. Pictures can be found here.