Hacker News new | ask | show | jobs
by shakna 3232 days ago
Scheme.

Simple, strongly typed, and really really easy to write and read.

On top of that, its fairly easy to compile as well, which gets rid of a bunch of distribution problems that come with other Lisps.

My first in-production experience was converting a monolithic Python web app to Scheme.

We wrote a library that brought a lot of Python conventions over to make things easier. Like an import macro that automatically namespaces things. (And we copied Clojure's "->)" macro for closing all open parentheses).

Total conversion for ~18,000 LOC Python to ~7,000 LOC Scheme took about nine weeks. The speed-up was about 2.5x.

And despite the much smaller codebase for Scheme - we actually added a whole heap of features, whilst matching all old features. (A bug or two as well, but that's to be expected).

Scheme is just really well suited to parsing, and rewriting itself as necessary.

So far as I'm aware, that stack is still running three years later, so Scheme wasn't just a fad for the team (who picked it up in about a week or so).

3 comments

> Total conversion for ~18,000 LOC Python to ~7,000 LOC Scheme took about nine weeks. The speed-up was about 2.5x.

You should really do a blog post on this and submit it to HN! So people could appreciate the real-world benefits of using a Lisp.

What is is about scheme that allows the 18k LOC to be condensed to 7k LOC? I assume there was some culling of excess code, but that's a dramatic improvement.
The biggest improvement was at the parsing/eval side of things.

Because Scheme has something utterly amazing, that I've seen in very few modern languages.

A safe eval function.

    (let foo foo
    (eval '(foo arg) (null-environment)))
Only what you bind to the environment exists, and in the case of null-environment, that's all that gets bound. (There are other environments you can use, or you can prebuild your own easily).

Scheme also provides string->symbol and symbol->string type conversions, which allow you to do things that are normally next to impossible, though mainly only useful in macros.

That can let you generate let-bindings on the fly, which if you contain them with a safe eval, gives you some really amazing possibilities.

Like parsing and binding URL queries.

Interesting. Which version of Scheme did you use for this? I really mean the "make", like Chez Scheme or some other, not the version number.
Gambit-C. [0]

Development is slower than most, because it's mostly a one-man operation, but it's fast, can statically compile, can make tiny binaries and is mostly compliant, and the dev fixes compliance/bugs fairly quickly.

Docs can be lacking at times, but the code is fairly clear.

[0] https://github.com/gambit/gambit

Thanks for the info. Cool that one person has done most of it.

Also, it was interesting to see that large-scale real-world software has been developed using it.

http://gambitscheme.org/wiki/index.php/Real-world_software_a...