New Blog Find
I found Milan Negovan's weblog while searching for info on the ASP.NET <machineKey> configuration element. His About page starts out:
The mission of this site is to promote both ASP.NET and web standards. It might seem to be a strange mix given the fact that ASP.NET has been notorious for not producing standards-compliant code so far. As any technology ASP.NET is evolving and we're here to learn how to take advantage of its power to write clean code.Milan also has a Neat tool to generate machineKeys on his site, though he doesn't seem to have the source code available.
— Gordon Weakliem at permanent link
What Scheme's Good At
I've been contributing a few recipes to the nascent PLT Scheme Cookbook. I've been basing my contributions on recipes from the Python Cookbook. This experience has really shown me the differences between the two languages. For example, I had to write my own version of Python's
expandtabs and the result is somewhat less readable than the Python version:
(define expand-tabs
(opt-lambda (str (tabstop 8))
(let loop ((result-parts '()) ; parts of the expanded string
(len-so-far 0) ; sum of the string-length of result-parts
(start-run 0) ; start of the next run of non-tab characters
(src-index (string-index str #\tab))) ; index of the next #\tab
(if (not src-index)
(foldl string-append "" (cons (substring str start-run) result-parts))
(let* ((current-length (+ (- src-index start-run) len-so-far))
(tab-len (- tabstop (modulo current-length tabstop))))
(loop (cons (make-string tab-len #\space)
(cons (substring str start-run src-index) result-parts))
(+ tab-len current-length)
(+ src-index 1)
(string-index str #\tab (+ 1 src-index))))))))
But then you get to the topics like Dispatching Based on Pattern Matches, or Replacing Python Code with the Results of Executing That Code, and the story changes. Pattern matching is an application of match that ships with PLT, and the latter is practically a description of Scheme macros and quasiquoting. What's made translation difficult in these cases is that the implementation in Python involves parsing Python out of some non-Python syntax, while the Scheme approach usually involves sticking with S-Expressions as much as possible. Which remind's me of a conversation I had the other day, where I concluded, "You can define any syntax you want in Lisp, as long as it looks like Lisp."