Posts

10,000 Memories

I had an amazing opportunity to attend a book signing for 10,000 Memories in Berkeley along with my wife.

10,000 Memories is a non-profit, volunteering and crowdsourcing project that has collected 10k witness accounts about the Partition across South Asia. There was an insightful panel discussion with the editors, and story telling sessions along with a curated exhibit.

The Partition has touched countless people across South Asia, and research puts numbers at 2-3M killed and 14-18M displaced. But what’s missing in mere numbers are the qualitative stories of people who were impacted, which is where such a systematic archival of witness accounts is so invaluable.

...

Fossil Carbon Until 2C

Reading Kim Stanley Robinson’s Ministry for the Future, I got curious about Chapter 8’s numbers, which essentially break down some of the main driving forces of the climate crisis better than most other things I’ve come across.

KSR describes how much fossil carbon we’re consuming, how much is left, how much should not be extracted if we want to stay below 2C, who owns what’s left, and what problems that suggests.

...

Can we abstract control flow?

Last week, I visited a couple of my professors from Northwestern to chat and help out with an interesting engineering “bootcamp” class they are teaching. Beyond the nostalgia, those interactions brought me back to my days in college, when I regularly felt this mixture of lighthearted fun and simultaneously an overwhelming awe at learning new things I didn’t even have the cognitive machinery to imagine before.

Maybe I’m blocking out the midterm anxiety, but still.

...

Playful Introduction to Racket

;; This is a playful introduction to Racket, using the in-built app
;; Dr. Racket, intended for a <60 min session.

;; Racket is a polygot-friendly, language designer friendly, beginner friendly
;; multi-paradigm general purpose programming language.

;; Install Racket and then open this little tutorial using Dr. Racket, by
;; saving it as a "racket_quick_intro.rkt" text file.
;; Download link for Racket: https://download.racket-lang.org

;; 1. Introduction

;; Dr. Racket is a multi-language IDE for Racket.
;; You can use Racket to make your own language or sub-language and then set
;; that as the language with a similar #lang invocation as below:

#lang racket

;; Racket and Dr. Racket excel as a language laboratory.

;; As a basic tour of this environment, let's try to write a simple prime
;; number checker.

;; Also, let's decide to test our code using an external package called
;; "quickcheck". To install this package, `raco pkg install quickcheck`, or
;; go to File > Package Manager... and install.
(require (prefix-in qc: quickcheck))

;; 2. Basic Code

;; General notes about discovering documentation:
;; - try hovering over names; they show where their bound occurences happen,
;;   or from where an occurence was bound
;; - for each unfamiliar name, try right clicking and searching it in the
;;   help desk.

(define (prime? x)
  (let* ([maxCandidate (exact-round (sqrt x))]
        [rangeCandidates (range 2 (+ maxCandidate 1))]
        [divisor? (lambda (y)
                    (= 0 (modulo x y)))]
        [divisors (filter divisor? rangeCandidates)])
    (if (= x 1)
        #f
        (empty? divisors))))

;; 3. Basic Tests

;; Let's explore how we'll test our code.

;; `quickcheck` is one of a category of "property based testing" libraries;
;; others are Haskell's quickcheck (of which this is a port), Python's
;; hypothesis, and probably many others.

;; We define a property to be checked. Maybe think of it as a predicate
;; of sorts.
(define prime?-returns-boolean
  (qc:property ([someNumber qc:arbitrary-natural])
               (boolean? (prime? someNumber))))

;; Here, we ask quickcheck to generate random values (we defined the values to
;; be provided as qc:arbitrary-natural) and test whether our property is really
;; true.

;; To run the check, run the quoted code in the REPL.
(quote (qc:quickcheck prime?-returns-boolean))
;; You'll note that when you hit run, the above line is printed in the REPL, so
;; you can copy and run it from there.

;; Let's test another couple of basic things.

(define prime?-is-correct-for-first-10-primes
  (qc:property ([someNumber (qc:choose-one-of (list 2 3 5 7 11 13 17 19 23 29))])
               (equal? (prime? someNumber) #t)))

(define prime?-is-correct-for-10-non-primes
  (qc:property ([someNumber (qc:choose-one-of (list 1 4 6 8 10 12 14 15 16 18 20))])
               (equal? (prime? someNumber) #f)))

;; To run the checks, run the quoted code in the REPL.
(quote (qc:quickcheck prime?-is-correct-for-first-10-primes))
(quote (qc:quickcheck prime?-is-correct-for-10-non-primes))


;; Recap

;; We got introduced to Racket and Dr. Racket, learned how to write some code
;; and test it, and learned how to explore documentation and install external
;; packages.


;; Next Steps?


;; Some fun options to choose your own adventure:

;; - module languages -- create you own language!
;;   (https://docs.racket-lang.org/guide/languages.html)

;; - racklog -- Racket's take on logic programming
;;   (https://docs.racket-lang.org/racklog/)

;; - typed/racket -- Racket's typed sister language
;;   (https://docs.racket-lang.org/ts-guide/)

;; Self plug: kilotau.com.

Direct link to the gist.

...

Engineering a Machine Learning Product

sun-through-trees

Our goal felt hidden, out of reach.

Our product, Frontier, focuses on building better student writers in grades 4-8 by challenging them with engaging narrative, informational, and argumentative writing projects: how does severe weather affect our lives? What does it take to be a gymnast? Do cats make good pets?

The goal to focus on building better writers through fast feedback grew out of our observations in teacher interviews and product research. We noticed state and national education standards increasingly emphasizing writing. We also discovered difficulties assessing student writing in a fast and complete way. Teachers were feeling the mounting pressure of teaching writing better, but lacked the opportunity to actually fulfill those requirements.

...

Bugs are your best friends

You open up your email, swipe through some work messages, and notice a classic email about a bug.

RuntimeError: Your app is terrible
app/controller/page:17 - what is
config/route/blah:24 - this I
bin/app:4 - can't even

It looks… strange. The error message and the stack trace look only vaguely familiar.

You would be forgiven for being annoyed or even anxious at that moment.

But that bug and its siblings are actually your best buddies. And that’s not just in an “always see the bright side of life” kind of forceful mental gymnastics way – there are visceral reasons to believe this.

...

Bring a bit of Clojure/Racket to Ruby!

I made a new gem based on some exploration I did, but to tell the story, let’s talk about a possible use case.

Let’s say you’re writing some Ruby code where you need to call a sequence of methods on some initial value. (This is a contrived example, so bear with me)

class FileChecker
  def report(file)
    # need to produce summary after running checks
  end

  # add error strings to an instance variable if check fails
  def check_columns(input); end
  def check_blanks(input); end
  def check_constraints(input); end

  # selects error strings and other info to return
  def summarize(input); end
end

There are probably several ways to approach this. You could, for instance, make the input in those check methods and that summary method not an argument but an instance variable that is implicitly provided, allowing you to do this in #report:

...

Problem solving like no one's watching!

Sometimes, you have a problem. A problem that itches and maybe even hurts.

The kind of problem where you wish “wouldn’t it be cool if…,” but then you follow that up and it’s clear that it’s either too difficult or would take more time than you have to spare. Or maybe you realize you don’t know something needed to solve it.

Here’s how you could scratch that itch, even if you think it’ll probably take too long.

...

Bayesian Thinking

This is based on a talk I gave at the Open Source Open Mic meetup, around Sep 2015. Slides from the talk.

Let’s say you’re walking down the street. You see someone walking towards you, and a question comes to mind:

barista-or-consultant

Barista or Consultant?

(A contrived case for sure, but humor me)

How would you answer this?

You could reason that this person’s clothes are quite representative of hipster fashion, so you might say that they are quite probably a barista.

...

Portentous Transmissions

I decided to write a short story about a ridiculous premise to get myself to just sit down and finish a story. Here’s the result!

A hooded jogger cuts through a dark alley nestled between a greasy burger joint and an old boarded up warehouse. Sarah’s muttering to herself as she runs at a steady clip, dictating some notes into her bluetooth mic.

A bubbling, anxious knot starts to form in her stomach, but Sarah ignores it. Without further warning, a sound like a dog’s surprised yelp breaks the silence. Embarrassed, Sarah furtively glances around to check if she’s alone.

...