1 Step Forward, 2 Step Backwards
Link: dating advice for men from women | MetaFilter.
Sometimes I wonder how the human race has managed to procreate.
Guess What This Ad Is For?
Here’s to the Crazy Ones.
The misfits.
The rebels.
The troublemakers.
The round pegs in the square holes.
The ones who see things differently.
They’re not fond of rules.
And they have no respect for the status quo.
You can praise them, disagree with them, quote them,
disbelieve them, glorify or vilify them.
About the only thing that you can’t do, is ignore them.
Because they change things.
They invent. They imagine. They heal.
They explore. They create. They inspire.
They push the human race forward.
Maybe they have to be crazy.
How else can you stare at an empty canvas and see a work of art?
Or, sit in silence and hear a song that hasn’t been written?
Or, gaze at a red planet and see a laboratory on wheels?
We make tools for these kinds of people.
While some may see them as the crazy ones, we see genius.
Because the ones who are crazy enough to think that they can change the world,
are the ones who do.
View this ad here.
This Myth Is Busted!
Link: Encyclopedia: MythBusters Episodes.
I love this show. It’s one of the cooler shows on TV right now.
Did I mention I saw Jamie Hyneman when I was in San Francisco? E had to help me contain my excitement. IT WAS SO FRIGGING COOL! Probably the most interesting thing that happened to me while I was down there.
See I Told You Slashdot Was Useful!
A nifty little trick I learned while reading slashdot .
Oh Haskell! I Can See You Too
Link: Visual Haskell.
When I said Haskell felt more academic…. Forget what I said. I fully expect the Haskell Enterprise Edition out any day now. It’ll probably have a cheesy quote to go along with it like: “Haskell - The purely lazily strongly statically typed choice for the monadic enterprise”.
I’ve Wanted to Learn This for Awhile
It’s 1 Am. Do You Know Where Your Sleep Is?
A Little Camel Said to Me, “Are You Being Objective?”
1. Write a function merge_i which takes as input two integer lists sorted inincreasing order and returns a new sorted list containing the elements ofthe first two.
This is one of the exercises in chapter 2 of Developing Applications with Objective Caml. Took me a little while since I don’t use a lot of recursion in my day job. On my first pass, I nailed the base case but the recursive case I messed up. I discovered this handy little trick when using the interpreter.
Objective Caml version 3.08.3
# use “test.ml”
val merge_i : int list -> int list -> int list = <fun>
# #trace merge_i;;
merge_i is now traced.
# merge_i [1;2] [3;4];;
merge_i <– [1; 2]
merge_i –> <fun>
merge_i* <– [3; 4]
merge_i <– [2]
merge_i –> <fun>
merge_i* <– [3; 4]
merge_i <– []
merge_i –> <fun>
merge_i* <– [3; 4]
merge_i* –> [3; 4]
merge_i* –> [2; 3; 4]
merge_i* –> [1; 2; 3; 4]
- : int list = [1; 2; 3; 4]
#
Aha! Initiallly, I was only passing the tail of the two lists on the recursive call. I needed to modify it to pass the tail of the list which I had used and pass the other list untouched. That trace feature in theinterpreter sure is handy (I believe lisp and ruby also have this in their REPL).
The solution came to this:
let rec merge_i (x:int list) (y:int list) = if x = [] && y = [] then [] else if x = [] then y else if y = [] then x else let a = List.hd x and b = List.hd y in if a > b then b :: merge_i x (List.tl y) else a :: merge_i (List.tl x) y ;;
(* in the last else, I had done (if a > b then b else a) :: merge_i (List.tl x) (List.tl y) initially *)
(* the if x = [] && y = [] then [] is probably superfluous but it’s late and I’m going to sleep *)
P.S (* *) is an OCaml comment. Very /* */ if you ask me.
O’Reilly Network: Painless Merging With SVK: An Interview With Chia-liang Kao
Link: O’Reilly Network: Painless Merging with SVK: An Interview with Chia-liang Kao.
SVK is currently my version control system of choice.