Skip to content

Instantly share code, notes, and snippets.

@pbostrom
Last active August 29, 2015 14:07
Show Gist options
  • Save pbostrom/431f01243ae7ee571686 to your computer and use it in GitHub Desktop.
Save pbostrom/431f01243ae7ee571686 to your computer and use it in GitHub Desktop.

That’s a lot to take in! No wonder we got it wrong! We’ll take it slow, and look at the arguments.

(condp (* temp time) <

Our pred was (* temp time) (a Double), and our expr was the comparison function <. For each clause, (pred test-expr expr) is evaluated, so that would expand to something like

((* temp time) 400 < )

Which evaluates to something like

(123.45 400 <)

But this isn’t a valid Lisp program! It starts with a number, not a function. We should have written (< 400 123.45). Our arguments are backwards!

@pbostrom
Copy link
Author

pbostrom commented Oct 2, 2014

Also the order of clauses was originally incorrect:
300 :soggy
350 :perfect
400 :burned
but gets correctly reversed without any explanation:
400 :burned
350 :perfect
300 :soggy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment