Tim’s Blog
-
Flatland
I finished reading Flatland. It’s a parable-style story about dimensions and geometry. As exciting as that sounds, it’s really good. I recommend it. You don’t have to be a math nerd to read it. I read the annotated version, but pretty much read the story straight-through, only using the notes when something struck a chord. […]
-
Static vs Dynamic Scope
A discussion of static and dynamic scope for variables in programming languages. Emacs lisp is one of the few languages with dynamic scoping and this post takes a look at the difference.
-
Arrays as Objects in Javascript
Rhino Prompt… js> a[0] = 1; js> a.print = function () {for(var e in this) print (“a[” + e + “] = ” + a[e]);}; function () { for (var e in this) { print(“a[” + e + “] = ” + a[e]); } } js> a.print(); a[0] = 1 a[print] = function () { […]
-
“wc”-like Unix Command in Emacs Lisp
Inspired by reading a Steve Yegge blog post. (require ‘cl) (defsubst wc-whitespace-char? () “is current character whitespace?” (not (looking-at “[A-Za-z0-9]”))) (defun wc-buffer (b) “count words in a buffer” (interactive “bBuffer to Analyze “) (let ((word-count 0) (in-word nil) (char-count 0) (line-count 1)) (save-excursion (set-buffer b) (beginning-of-buffer) (while (not (eobp)) (if in-word (if (wc-whitespace-char?) (setq in-word […]
-
Understanding Read-Only Properties with Object (Refererence Types)
using System; using System.Text; namespace TestReadOnly { class Program { static void Main(string[] args) { MyClass1 myObject1 = new MyClass1(); // myObject1.MyObject2 = new MyClass2(); // clearly illegal // legal, reference is read-only, not object myObject1.MyObject2.x = 1; Console.WriteLine(“myObject1.MyObject2.x: {0}”, myObject1.MyObject2.x); // also legal, similar to above, anotherObject2 is just a reference to the same […]
Got any book recommendations?