Posterous
Diego is using Posterous to post everything online. Shouldn't you?
N100086_35606447_5490_thumb
 

Real unintelligence

Amateur functional programming, AI, and machine learning.

David, with blur

Posted November 2, 2009
// 0 Comments

Jalapeño fetish, pt 2

Found the culprit (food request list in our kitchen).

Posted September 2, 2009
// 0 Comments

Jalapeño fetish

I swear this photo was not staged... Someone must love jalapeños!

Posted September 1, 2009
// 0 Comments

Moving day

Posted August 30, 2009
// 1 Comment

Beautiful post-storm scenes

After a big storm in Toronto last week, some photographers went out
and grabbed amazing shots. I love post-storm skies (and Toronto!).

 http://torontoist.com/2009/08/tornado_gallery.php?gallery0Pic=15#gallery

Posted August 24, 2009
// 0 Comments

Need gas

I had 1 mile left, and then 0, and then it just gave up altogether.

Posted August 13, 2009
// 0 Comments

Berkeley Marina

Posted August 8, 2009
// 0 Comments

Fishbowl room service

Posted August 3, 2009
// 0 Comments

ex2.27: less intuitive

for some reason this took me a lot longer than it should have. in part because i lost my mental grip on how the linked lists are structured in memory. for example, with x shown below, (car x) is (1 2) but (cdr x) is ((3 4)). i find when writing procedures like this in scheme it's easier to grab a pen and paper, because the density of the language makes it hard for me to visualize it on screen (a common criticism of lisps).
 

 
;exercise 2.27 - deep reverse 
;loop invariant: put head onto the list and process what's next 
(define (deep-reverse l) 
  (define (deep-reverse-iter l accum) 
   (cond ((null? (cdr l)) 
      (if (list? (car l)) 
      (cons (deep-reverse-iter (car l) ()) accum) 
        (cons (car l) accum))) 
      (else 
      (if (list? (car l)) 
        (deep-reverse-iter (cdr l) 
                  (cons (deep-reverse-iter (car l) ()) accum)) 
      (deep-reverse-iter (cdr l) 
                  (cons (car l) accum)))))) 
  (deep-reverse-iter l ())) 
 
(define x (list (list 1 2) (list 3 4))) 
;Value 30: ((1 2) (3 4)) 
 
(reverse x) 
;Value 31: ((3 4) (1 2)) 
 
(deep-reverse x) 
;Value 32: ((4 3) (2 1)) 

 
i don't like the duplicated logic in the if statements (essentially the same choice to decide whether i need to iterate down the left subtree or not). i could pull that out and set it as lambda:
 
 
(define (deep-reverse l) 
  (define (deep-reverse-iter l accum) 
   (let ((left-action (if (list? (car l)) 
               (lambda (l) (deep-reverse-iter (car l) ())) 
               (lambda (l) (car l))))) 
    (cond ((null? (cdr l)) 
       (cons (left-action l) accum)) 
       (else 
       (deep-reverse-iter (cdr l) 
        (cons (left-action l) accum)))))) 
  (deep-reverse-iter l ())) 

 
this works too, although it would probably be less clear without having seen the first version.

Posted July 10, 2009
// 0 Comments

find what you love, then do it

There are far too many smart, educated, talented people operating at quarter speed, unsure of their place in the world, contributing far too little to the productive engine of modern civilization. There are far too many people who look like they have their act together but have yet to make an impact. You know who you are. It comes down to a simple gut check: You either love what you do or you don't. Period.

(from http://www.fastcompany.com/magazine/66/mylife.html, via HN) 

this is precisely how i see things. if you find something you love, you will be good at it and you will enjoy doing it (and unsurprisingly, these are highly correlated results). right now i'm searching for something that makes me feel this way. i've already tried a number of directions at a young age, and in each one people have told me that i'm good at what i do. yet, in all cases, i haven't lived up to the most important standards: my own.

Posted July 5, 2009
// 2 Comments