
Scheme in the real world - Zak
Is anybody here using Scheme in the real world? Common Lisp has been my language of choice for a while now, but I'd like to try something a little less bulky.  There are two types of projects I'm working on with very different requirements. I'm considering Scheme for both.<p>The first is standard webapp development. I've been using Hunchentoot, CL-WHO and friends here, and I'm experimenting with Weblocks. I generally like these tools, but I'm open to trying tools that work differently. I'd like to know what tools the Scheme users here prefer for web work.<p>The other project is a desktop/embedded (fairly fast PC hardware) system with soft real-time requirements (for the curious, it's a DMX lighting controller). I'm looking for speed, multithreading and some predictability in the garbage collector.
======
herdrick
We're using Scheme in our startup and I recommend it. Our web app is built in
Kawa and runs on the Tomcat server. We had been using the PLT web server but
left over some concerns with the way it was using memory. They've fixed that
and now I think switching was a mistake - we should have just stuck with PLT.
Kawa... hoo boy. It's got some issues. It's still Scheme, though, mostly.

So for the web I would use PLT and its great web server. In fact I do use it
for a little internal app and love being able to write a web app in the
'direct style' ie just write a web page interaction with a user as a function
execution. You can just assign a lambda to a link, saying 'when the user
clicks this link, execute this lambda'. It's great. However, that links won't
be bookmarkable nor indexable by search engines, so if some of your pages need
to be, you have to make the links to them be traditional links. So the
continuations-based stuff lends itself to the parts of your app that are
private to a single user (like taking user input or showing them their email)
and/or shouldn't show up in a search engine anyway. This would include
anything that you would describe as a 'wizard'.

NASA (or is it just the Air Force?) is using PLT Scheme to control a large
telescope in New Mexico (<http://news.ycombinator.com/item?id=75219>) to great
success. So for soft real-time stuff you should be good. Just from using it, I
wouldn't recommend the default garbage collector with PLT for anything like
hard real-time stuff. But there are other GCs, so ask around. The PLT mailing
list is excellent: <http://www.plt-scheme.org/maillist/>

~~~
michaelneale
Good luck with your startup, make sure you tell us when it launches !

~~~
herdrick
Thanks! We'll definitely post our launch here.

------
coffeemug
Zak, why does it matter to you if someone is using Scheme in the real world?
The question you should be asking is if you can use it to your advantage to
outperform others who aren't using it.

So far, the biggest issue with Common Lisp I ran into while writing Weblocks
is lack of continuations. There were other issues but they were minor
annoyances that were fairly easy to overcome. Right now I'm working on a
delimited continuations library for CL. Writing one really isn't as bad as it
sounds - I think On Lisp unnecessarily scares people from rolling their own
code walker.

Out of curiosity, other than continuations, what advantage do you see in using
Scheme over CL?

~~~
Zak
A big part of it is the fact that Scheme is simple and Common Lisp is not.
This is a "soft" feature, but I think it's important. I want to try out Scheme
and see if it feels better.

I ask because I'd like to get a perspective on the tools that are available
from people who actually make things with them. The programming language I use
might be a "secret weapon" in some situations, but most of the people it would
give me an advantage over wouldn't even understand why it's an advantage.

~~~
viergroupie
The problem I had with Scheme was that it doesn't stay simple. The core is
certainly more elegant than Common Lisp's, but all the cruft has a nasty way
of sneaking back in through SRFIs and big hairy macros.

------
GreyLensman
Good timing Scheme is undergoing quite a bit of change that should culminate
in about 6 months.

I have used scheme at work and for the last 6 weeks on a private project in
earnest.

One issues is that there are a lot of scheme implementations out there. Some
good, great, average, and others bit rotted. Only mention two here.

DrScheme/MzScheme is pretty amazing. It is fully loaded and few know of its
full capabilities. The fact that PG can just "write" Arc in MzScheme and some
other pretty neat things that are doable in MzScheme is not an accident.
DrScheme/MzScheme is much, much more then Scheme in a way not too many people
understand.

The second implementation is Larceny. True native compiler. Plenty fast. The
compiler is written in Scheme (small C runtime). Its hackable from top to
bottom. Extensible and did I say fast? Threading is fair or green threads
using continuations/call-cc (no O/S threads). Don't like the Scheduler? Modify
it, its in tasking.sch The interrupt handler is a lambda function, just
redefine it. Don't like the i386 code output, hack the assembler or the
optimized 5 pass compiler. Its all in Scheme.

Don't like standard poll, I added epoll via the FFI in a few hours.

Larceny has been around for years, but is undergoing a resurgence to bring it
up "closer" to the new R6RS standard.

I think it has great potential. Be advised that do to the rapid changes in
development underway that there are some rough edges in certain "library"
areas, however, the core compiler is solid and stable.

Awhile back Slime was ported over to Scheme48 (not a system for general real
world use, but a fun hacking implementation). The compiler group should have
Larceny stable with many of the libraries and features of the new R6RS
standard (some will not implemented). IF SLIME scheme backend was ported over
to Larceny as well. It could be the start of something special.

------
pg
You used it to post this question. News.YC is written in a version of Arc that
runs on MzScheme.

~~~
michaelneale
yeah that is really really cool. Any hints on Lines Of Code __

__Don't tell if you don't want to, or if you think its too long ! Maybe paren
count is more appropriate ;)

I am guessing amazingly concise.

~~~
herdrick
Ask him to run trav (tree-fold) on the code:
<http://news.ycombinator.com/item?id=32766>

~~~
pg
Currently the code tree is 9573 nodes. About 1500 lines of code. It's fairly
tight at this stage, because I recently went through it and squeezed out a lot
of the fat.

~~~
plinkplonk
wow! 9573 nodes is _very_ concise!

I just ran a scheme equivalent of trav on one of my code files and get a count
of 300 (on a very small file). This could of course mean that my code is
bloated, but I am impressed anyway!

Just curious, but does arc have its own macro system? Or do you use MZScheme's
macros?

------
brlewis
I'm using Scheme both in the real world of my daytime employment, and in the
fake world of my personal project. It was web development that brought me back
to Scheme after 12 years of C. I wrote BRL in order to make server-side web
development easier, especially when making database-driven sites.

What I don't understand is why you want something "a little less bulky"? Can't
you use a subset of CL?

~~~
coffeemug
Do you mind sharing where you work?

~~~
brlewis
Like most people I know of who use Scheme or other Lisps in the real world,
I'm in the financial services industry. Here's a job opening for someone who
would report to me:

[https://tbe.taleo.net/NA4/ats/careers/requisition.jsp?org=EA...](https://tbe.taleo.net/NA4/ats/careers/requisition.jsp?org=EATONVANCE&cws=1&rid=73)

------
avibryant
So, IIRC DMX runs at about 44hz if you've got a full dimmer pack (which isn't
hard with moving lights since they each take a bunch of channels). That means
you get about 20ms to compute each cycle, which strikes me as pretty soft
indeed if you're running on PC hardware... I wouldn't worry about performance
until you see problems.

Eons ago, I remember building a DMX controller by ripping out the clock from a
standard RS485 card and soldering in a new (8khz?) one from Radio Shack so the
baud rate would be right...

~~~
Zak
I'm not worrying too much about performance yet, but I do see it as a
potential issue. I'm trying to design a scriptable effects engine that could
allow users to do things that are inefficient. This may sound like premature
optimization, but I don't really see a downside to preferring implementations
that tend to be fast.

------
tmpuser
You should try hop - best Scheme for the web today: <http://hop.inria.fr/>
[http://hop.inria.fr/usr/local/share/hop/weblets/home/article...](http://hop.inria.fr/usr/local/share/hop/weblets/home/articles/hop-
lang/article.html)

Also, it has a scheme-to-javascript compiler inside it...

If you really like Java, SISCWeb is also nice.

------
shiro
Recently I did a consulting job for a project of a kind of network backbone
testing suites used by one of major telcom providers in Japan. The suite was
mainly in CL, but my part was an independent, stand-alone tool and I used
Scheme (Gauche). It was a distributed, multithreaded app that opened raw
sockets and sent/received fair amount of ICMP packets. The main app was just
around 1000 LOC in Scheme, though it used quite a few libraries came with
Gauche.

Speed didn't become an issue even Gauche wasn't a native compiler (it compiles
to VM), for the network driver was always the bottleneck. Yet I did care not
to cons in the inner loop.

------
boucher
Out of curiosity, why would you want to use a garbage collected language at
all if you have real time requirements.

~~~
Zak
I don't want to do memory management. It's the sort of error-prone process I
feel is generally better left to a machine. I think the timing uncertainties
inherent in GC can be mitigated to the point that they don't affect
performance.

~~~
tmpuser
You are right. RScheme has a real time garbage collector

<http://en.wikipedia.org/wiki/RScheme>

------
michaelneale
I certainly hope so (that there are people using it). And increasing it.

