Category: Scheme

Code-stealing macros (by )

I'm reading Thinking Forth, which has conveniently been made available as a PDF for free reading, and a reference therein to the ability of languages with metaprogramming facilities to represent things that, in other languages, might need to be part of the language core as user libraries:

Nevertheless a brilliantly simple technique for adding Modula-type modules to Forth has been implemented, in only three lines of code, by Dewey Val Shorre

Read more »

Scheme bindings (by )

One of the things I don't like about Scheme is that just about everything in it is mutable. The most awkward ones are the value bindings of symbols.

You see, when a Scheme implementation (compiler or interpreter) is processing some source code, at any point in the program it is aware of the current lexical environment - the set of names bound at that point in the program, and what they're bound to.

Read more »

Source Transformation for Fun and Profit (by )

Back when I was a kid, I designed a low-level macro system for purely functional Lispy languages, based around a cunning use of partial evaluation. I called it meta.

Since I was a dreadfully lazy student, when I had to do a final year project, I suggested it as an idea and then pretended to think of and develop it all over again, before spending far too little time writing up a report on it, and a sample implementation. Which may have been why the sample implementation broke in the demonstration...

But at the time, I didn't think much of macro hygiene. All I'd seen of it was that Scheme at the time had a hygienic macro system called syntax-rules that, as far as I could tell, sucked - it was limited to basic-seeming rule-based substitutions, and did not use the full power of the Scheme language as a macro language.

However, things have changed since then. The Scheme community has come up with hygienic macro systems that let you write macros in Scheme, such as syntactic closures. And so I've found that hygiene is a desirable property, rather than a terrible design tradeoff.

So, I wonder to myself, can my meta macro system be brought up to date and incorporate hygiene?

Read more »

Cloth badges (by )

As I mentioned before, I have a cloth badge sewn onto my coat of many pockets. Now, Sarah is an avid collector of most things, including such badges; she has bags and boxes of them, generally not sewn onto anything. I don't have the urge to collect like that, but I wouldn't mind a few more to sew onto my coat.

I wouldn't want just any badges sewn on, though; I'm not even keen on picking up badges from places I visit and sewing them on to mark the event.

I think I'd probably like some nerdy ones, to be honest. A NetBSD logo or a hacker emblem would be pretty cool. But I'd really like something Lispy, so I designed the following:

Now, I've found places that will make badges for you, but the minimum orders tend to be in the realm of 100, at a cost of 85 pounds or so... and I don't know if I can sell the spares on to anybody 😉 Perhaps I need to set up a "nerdy cloth badges" business...

The SVN source is available for download, BTW. It was made on a Mac and uses an Apple font for the nice curly lambda, but I'm sure other platforms will have a good font that can be used instead.

WordPress Themes

Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales
Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales