cdiggins.com

October 30, 2007

Cat Language Tutorial

Filed under: Everything — cdiggins @ 2:07 pm

I have just posted a tutorial for Cat at http://www.cat-language.com/tutorial.html.

October 29, 2007

Cat Interpreter (v1.1) in Javascript

Filed under: Everything — cdiggins @ 6:27 am

I’ve just released a new version of the online Cat interpreter in Javascript.

The code is public domain, so it might be of interest for those who like neat JavaScript hacks … or maybe it is just a mundane Javascript hack. I don’t really know, I just wanted people to be able to play with Cat online.

October 28, 2007

Update on Cat in JavaScript (and the lack-of native SVG support in IE 7.0)

Filed under: Everything — cdiggins @ 4:05 pm

The current Cat in JavaScript, with enhancements and improved portability provided by Takashi Yamamiya , is at http://www.cat-language.com/interpreter.html . I am considering extending this implementation with graphics. I think it would make the online version very attractive, and an interesting tool for teaching programming. Unfortunately there is no good standard for actually drawing in a browser. SVG is very attractive, but unsupported by IE !? The Adobe SVG viewer is going to be abandoned on January 2008 (or is January 2009? Adobe contradicts themselves). It would be fun to simply abandon support for IE altogether, but I am not sure that it would be a smart choice, because I would be simply alienating a huge percentage of my potential audience.

So why isn’t Microsoft supporting SVG? There have been no shortage of requests. Clearly the IE developers know of the intense desire, and that their closest competitor supports it. I believe it’s because providing native SVG support would steal thunder from Microsoft’s Silverlight project. Just consider this post on hacking SVG support in IE using Silverlight and keep in mind that Microsoft has invested a lot of money into Silverlight. From a business perspective they can’t afford to undermine Silverlight right now by providing alternative means to implement Silverlight.

I wonder if Microsoft can dig a hole so big, that even they can’t climb out of? Wouldn’t it be nice if the web were to become dominated by open standards again?

So there are clearly some hacks to provide a layer to support SVG on both major browsers. This seems too time consuming for me. Another obvious option is to simply use a Java applet. Then it is no longer Cat in JavaScript, but at least it would be an online version of Cat. This is probably an acceptable option, and by creating signed applets I can allow file I/O as well.

I’d like to hear your thoughts on the Cat mailing list.

October 27, 2007

This spam made me smile

Filed under: Everything — cdiggins @ 9:20 pm

This was some recent spam that managed to get through my GMail spam filter. The subject line was literally “Your Credit Card Info and Your Limit!!!”. That alone made me smile.

Dear Friend

I am Mr. Donald Willy by name, I will like to inform you about our Part Time
Job Offer, We have some Job online that you will be at Home and be Receiving
your Money.. All you need it to give us your Credit Card Information and the
Limit of the Credit Card so that our Company will be wire money into the
Credit Card account and you will be Receiving the money everyday in your
country.

We are hereby assure you that you will be Receiving %50 percent of the money
and please let your Credit Card Information and the Limit is good, if you
Provided all this Information you will be receiving a letter from the
Company about knowing you very well before we can transfer the money into
your Credit Card Account ….We are Looking forward to hear from you..

Best Regard’s
Mr. Donald Willy
Big Brother Co. Ltd

I just loved the simple naivete of it all, and the fact he couldn’t even be bothered to make a convincing case for me to send him my credit card info. The company name was a nice touch I thought as well.

October 26, 2007

Scheme versus Christopher

Filed under: Everything — cdiggins @ 1:20 pm

Over the last while I have been trying to master macros (technically Gambit Scheme macros which provides a simplified macro form — I am quite sure define-macro can be defined using R5RS macro syntax). I was having trouble, because I thought I knew some things about macros that I didn’t really. I decided to test my knowlege by trying to write a simple macro that would return a list of all arguments passed to the macro, minus the first two. I wanted to do this with and without quasiquotes. Well it turned out harder than I expected. For your amusement (because you get to laugh at me if you know Scheme) I thought I would post a transcript of my experiments:

> (define-macro (m $x . $xs) ',(cdr $xs))
> (m 1 2 3)
*** ERROR IN (stdin)@353.1 -- Unbound variable: unquote
1> ,t
> (define-macro (m $x . $xs) ',@(cdr $xs))
> (m 1 2 3)
*** ERROR IN (stdin)@356.1 -- Unbound variable: unquote-splicing
1> ,t
> (define-macro (m $x . $xs) '(cdr ,$xs))
> (m 1 2 3)
*** ERROR IN (stdin)@359.1 -- Unbound variable: unquote
1> (define-macro (m $x . $xs) '(cdr ,@$xs))
*** ERROR IN (stdin)@360.1 -- Ill-placed 'define-macro'
1> ,t
> (define-macro (m $x . $xs) '(cdr ,@$xs))
> (m 1 2 3)
*** ERROR IN (stdin)@363.1 -- Unbound variable: unquote-splicing
1> ,t
> (define-macro (m $x . $xs) `(cdr ,$xs))
> (m 1 2 3)
*** ERROR IN (stdin)@366.1 -- Operator is not a PROCEDURE
(2 3)
1> (define-macro (m $x . $xs) `(cons ('list (cdr ,$xs)))
)
*** ERROR IN (stdin)@367.1 -- Ill-placed 'define-macro'
1> ,t
> (define-macro (m $x . $xs) `(cons ('list (cdr ,$xs))))
> (m 1 2 3)
*** ERROR IN (stdin)@371.1 -- Operator is not a PROCEDURE
(2 3)
1> (define-macro (m $x . $xs) `(cons 'list (cdr ,$xs)))
*** ERROR IN (stdin)@372.1 -- Ill-placed 'define-macro'
1> ,t
> (define-macro (m $x . $xs) `(cons 'list (cdr ,$xs)))
> (m 1 2 3)
*** ERROR IN (stdin)@375.1 -- Operator is not a PROCEDURE
(2 3)
1> (define-macro (m $x . $xs) (cons 'list (cdr ,$xs)))
*** ERROR IN (stdin)@376.1 -- Ill-placed 'define-macro'
1> ,t
> (define-macro (m $x . $xs) (cons 'list (cdr ,$xs)))
> (m 1 2 3)
*** ERROR -- Unbound variable: unquote
> (define-macro (m $x . $xs) (cons 'list (cdr $xs)))
> (m 1 2 3)
(3)

Yay! I managed to get it to work without quasiquotes. Now to try to get quasiquotes to work.

> (define-macro (m $x . $xs) `('list ,(cdr ,$xs)))
> (m 1 2 3)
*** ERROR -- Unbound variable: unquote
> (define-macro (m $x . $xs) `('list ,(cdr ,@$xs)))
> (m 1 2 3)
*** ERROR -- Unbound variable: unquote-splicing
> (define-macro (m $x . $xs) `('list ,(cdr $xs)))
> (m 1 2 3)
*** ERROR IN (stdin)@387.1 -- Operator is not a PROCEDURE
(3)
1> (define-macro (m $x . $xs) `('list ,@(cdr $xs)))
*** ERROR IN (stdin)@388.1 -- Ill-placed 'define-macro'
1> ,t
> (define-macro (m $x . $xs) `('list ,@(cdr $xs)))
> (m 1 2 3)
*** ERROR IN (stdin)@391.1 -- Operator is not a PROCEDURE
('list 3)
1> (define-macro (m $x . $xs) `(list ,@(cdr $xs)))
1> ,t
> (define-macro (m $x . $xs) `(list ,@(cdr $xs)))
> (m 1 2 3)
(3)

And now I finally managed to get it to work with quasiquotes.

This was not the first battle I had with Scheme, but it was the first one where I feel like I scored a decisive victory. I now understand clearly what went wrong, and why these versions work the way they do. However, those error messages were so useless. I mean “Unbound-variable unquote splicing”, how is that helpful unless you already know Scheme? Besides “unquote splicing” and “unquote” aren’t variables! The “operator is not a procedure” message on the other hand was helpful, because it showed the offending expression.

Perhaps in another couple of months, I will start becoming a smug Scheme programmer going around telling people who are struggling how easy it is to program in Scheme. If that happens point me back to this blog post, so I remember my growing pains.

October 23, 2007

Context Oriented Programming is not Aspect Oriented Programming

Filed under: Everything — cdiggins @ 6:22 pm

Last night I attended a talk by Pascal Costanza about Context Oriented Programming (see: http://p-cos.net/documents/contextl-overview.pdf ) at the Montreal Scheme and Lisp Users Group. Many people in the audience seem confused as to the difference between it and Aspect Oriented Programming. Both approaches deal with the notion of cross-cutting concerns, and both are heavily influenced by Howard Cannon’s work on Flavors. However COP is a constructive approach to expressing cross-cutting concerns using layers, whereas AOP is a destructive approach using point-cuts. IMHO COP has more promise for use in software engineering, while AOP will prove to be more useful for software hacking.

October 22, 2007

A New Cat: Version 0.18.0 Released

Filed under: Everything — cdiggins @ 7:13 am

I have made a new release of Cat that fixes several bugs and adds more tests (http://code.google.com/p/cat-language/downloads/list). Try “#ta” to run all tests. The documentation is unfortunately quite a bit out of sync with this version. I hope to get to that soon. One of the big changes is the fact that I am no longer going to be supporting all recursive forms. You can still write a large number of recursive programs, but recursive combinators (like Y and M) are no longer supported. They may be reintroduced after version 1.0, but I doubt they will be missed for now.

October 21, 2007

The U.S. Patent Office … Stranger than Fiction

Filed under: Everything — cdiggins @ 12:39 am

This has to be seen to believed: http://www.google.com/patents?id=g54QAAAAEBAJ

A patent on a “nail-removing tool”.

October 20, 2007

Where are the Blog Posts?

Filed under: Everything — cdiggins @ 2:27 pm

I feel a bit bad for not being able to contribute to my blog more regularly, or even to keep up on my emails, but unfortunately I am drowning in work. I am at school full-time doing a semester of prerequisite courses for a Master’s degree. At the same time, I recently submitted two papers to the International Conference on Compiler Construction. I have now also started on another paper for PLDI 08, and I am planning on starting a second for that conference. I am not doing these papers alone, I have some pretty amazing people to work with (Marc Feeley, Stefan Monnier, David Haguenauer, Etienne Bergeron) but the papers are very time consuming.

I love doing research, and writing papers. Who knows, maybe scientific writing and research will become my preferred means of communication instead of the blog.

There really is a new Cat coming down the pipe, real soon now!

October 10, 2007

Scheme-Cat now has its own site

Filed under: Everything — cdiggins @ 12:13 pm

Ben Chambers’ Scheme-Cat, an implementation of Cat in Scheme, now has its own Google code-hosting site: http://code.google.com/p/scheme-cat/

Next Page »

Powered by WordPress