[racket] Common Lisp or Racket?

1,708 views
Skip to first unread message

Lawrence Bottorff

unread,
Nov 12, 2013, 11:56:09 AM11/12/13
to users
I'm your typical newbie who is hand-wringing over what direction to go in the general functional programming world. Lisp, Scheme, or Haskell?

Of late I've been trying to get through the Barski book, "Land of Lisp," but I'm really seeing now why Scheme was created: CL seems to have a ton of gnarl that is part-functional, part-whatever, leaving me wondering and neurotic. And so I'm trying to understand some esoteric, arcane Lisp printing/file management weirdness -- which I'm told is not proper functional style -- after I've just been introduced to yet another CL map variation, after (funcall thunk). So I guess I'd like your advice vis-a-vis Racket. Q: Is Racket "cleaner," or is full of pork too? Or have I just got the wrong book for a beginner?

I understand that Barski is slavishly following the "let's get real stuff done" philosophy, but I'm not up to speed with functional yet to even know what's going on. Is your "Realm of Racket" better at this? I feel like I'm spinning my wheels at this point. . . .

LB


Alexander McLin

unread,
Nov 12, 2013, 12:47:14 PM11/12/13
to Lawrence Bottorff, users
Racket is truely a great and cleaner Lisp. It's carved out its own path that I find quite attractive and am enjoying my forays into Racket.

I would recommend you just get started with The Little Schemer to get a taste, move on to How To Design Programs. There is a Coursera course that uses HTDP, although I haven't taken it myself, is probably easier to stick with than going through HTDP on your own. Realm of Racket is a nice book but best read after you've already had some experience with a Lisp dialect.

Find or plan a project using Racket as your main coding language to help you use and grow with it. For example I'm using Racket to develop programs for the Coursera Bioinformatics Algorithm course.

However, I want to tell you that Common Lisp resources has plenty of valuable information to learn even if you don't end up using CL regularly. I'm not really a CL user but I still read a lot of CL books for interesting Lisp history and techniques.

Racket is also especially nice that it has a strong academic and theoretical community with high quality written papers which are good source of material to understand more about language design and usage.


____________________
  Racket Users list:
  http://lists.racket-lang.org/users


Hendrik Boom

unread,
Nov 12, 2013, 2:10:22 PM11/12/13
to us...@racket-lang.org
I should mention that another, quite different approach to functional
programming is the language OCAML. See http://ocaml.org/ for details.

I program using Scheme and OCAML as high-level languages.

By the way, I don't do exclusively pure functional programming. Most
of my code is functional, but I use imperative mechanisms when
apppropriate. I consider that building real systems as pure
functional code is extremism bordering on masochism.

-- hendrik

Matthias Felleisen

unread,
Nov 12, 2013, 2:20:26 PM11/12/13
to Alexander McLin, users

Lawrence, let me supplement Alex's answer. if you have programmed before, dive right into Realm. If it is your first real adventure in programming, take the time to work through HtDP. -- Matthias

Tomasz Rola

unread,
Nov 12, 2013, 9:12:59 PM11/12/13
to us...@racket-lang.org, Tomasz Rola
On Tue, 12 Nov 2013, Hendrik Boom wrote:

> On Tue, Nov 12, 2013 at 10:56:09AM -0600, Lawrence Bottorff wrote:
> > I'm your typical newbie who is hand-wringing over what direction to go in
> > the general functional programming world. Lisp, Scheme, or Haskell?
> >
[...]
> >
> > I understand that Barski is slavishly following the "let's get real stuff
> > done" philosophy, but I'm not up to speed with functional yet to even know
> > what's going on. Is your "Realm of Racket" better at this? I feel like I'm
> > spinning my wheels at this point. . . .
> >
> > LB
>
> I should mention that another, quite different approach to functional
> programming is the language OCAML. See http://ocaml.org/ for details.
>
> I program using Scheme and OCAML as high-level languages.

I may be very much wrong, so I cowardly apologise in advance, but I
happened to subscribe to certain Haskell related NGs just in time to
witness, kind of, interesting exchange there. In short, some
incompatibilities were introduced into ghc (AFAIR) and this rendered some
(a lot?) of working code uncompilable. I did not follow it to the very
end, because at one point I simply lost interest. The tone I remember was
"what, they can't update their code to agree with new compiler - too bad,
let's drop the ballast and move on". My conclusion was, Haskell was still
in the making. So if I decided to use it, I should be prepared to rewrite
my code from time to time. And this is exactly the thing I hate - I hate
rewriting the code, be it from one language to another "cooler" language
or from dialect to dialect or from one program fragment to another. I
really appreciate attitude of gcc compiler, which, at least in theory,
allows me to compile very old code without a problem [1].

I'm not sure if Ocaml is more like gcc or more like ghc, but I decided to
learn it rather than H*.

As of Racket vs CL, I think they are very comparable, with CL's one leg
stuck in prehistory (the filesystem concept scared the bejesus out of me,
almost) and Racket being modern and a bit alien to me, who licked (shyly)
Dybvig's book in times of R4RS... But, the docs are great, so I can
actually fire up drracket, google for some pointers in the docs and write
code in, say, quarter hour or a few. Batteries included, thanks a lot for
them :-). So for a beginner, Racket is a very good choice. Ability to use
some Scheme introductory material, complete with real R5RS mode (it is
fully compatible, isn't it :-) ), is great bonus, because it allows for
more choices - I am trying to tutor my sister (already graduated, so
English and logic is not a problem), and the choice of first intro book to
programming is crucial. SICP have just been toppled down, now I am on the
look again :-).

(OTOH, I'm not sure if I'd want to write compiler in Racket. Maybe. For a
while, I want to use both CL and R* and see what happens.)

> By the way, I don't do exclusively pure functional programming. Most
> of my code is functional, but I use imperative mechanisms when
> apppropriate. I consider that building real systems as pure
> functional code is extremism bordering on masochism.

Yes. One more reason to rethink using Haskell, I guess... Pure functional
looks cool in theory and blogs but in every day get-stuff-done it might be
not so cool and pure anymore, at least in my case. Besides, I understand
that the need for monads makes it dirty functional. So I play it safe. Of
course I don't mean Haskell is bad or wrong choice. It just is not the
best choice for every problem, but I guess I will learn it, some time
later.

[1] I wanted to quickly prove it with some code I downloaded in 1995, but
gcc complained about "redefined identifiers" and stuff, so in practice
some rewriting is required here, too (yes, I gave it "-ansi" but maybe
there is some more options to experiment with, maybe I will).

Regards,
Tomasz Rola

--
** A C programmer asked whether computer had Buddha's nature. **
** As the answer, master did "rm -rif" on the programmer's home **
** directory. And then the C programmer became enlightened... **
** **
** Tomasz Rola mailto:tomas...@bigfoot.com **

zbyszek

unread,
Nov 13, 2013, 2:05:26 AM11/13/13
to Lawrence Bottorff, users
Dnia 2013-11-12, wto o godzinie 10:56 -0600, Lawrence Bottorff pisze:
> I'm your typical newbie who is hand-wringing over what direction to go
> in the general functional programming world. Lisp, Scheme, or Haskell?
>
>
> Of late I've been trying to get through the Barski book, "Land of
> Lisp," but I'm really seeing now why Scheme was created: CL seems to
> have a ton of gnarl that is part-functional, part-whatever, leaving me
> wondering and neurotic.

Historically, Scheme was created first. CL is based on first Scheme
experiences, but had to be ,,industry'' oriented (the editor of first
CL standards was one of the creators of Scheme). This explain some
compromises, which had to be done.

> And so I'm trying to understand some esoteric, arcane Lisp
> printing/file management weirdness -- which I'm told is not proper
> functional style -- after I've just been introduced to yet another CL
> map variation, after (funcall thunk). So I guess I'd like your advice
> vis-a-vis Racket. Q: Is Racket "cleaner," or is full of pork too? Or
> have I just got the wrong book for a beginner?

Depends. The full standard of Scheme (r6rs) is more than 200 pages,
but large part of it is taken by libraries. Common Lisp included
them from the beginning.

Superficially, Scheme is simpler, e.g. single namespace, simple
printing etc. On the other hand, Scheme contains full continuations,
which are probably the most advanced control structure.

My advice (if you have time): try both (and may be Ocaml or Dylan too)
and compare which fits you best - they all come from the some set of
concepts.

Regards

ZJ

Ben Duan

unread,
Nov 13, 2013, 8:48:14 AM11/13/13
to Matthias Felleisen, users
I'm wondering who are the target readers for Realm. Is it written for kids? I have already spent some time in Racket and want to read some idiomatic Racket code. Is it a suitable book?

Thanks,
Ben

Matthias Felleisen

unread,
Nov 13, 2013, 9:06:47 AM11/13/13
to Ben Duan, users

Realm is targeted at readers who have something like a semester or two of programming experience. Ages 16--80 I'd say but exceptions in both directions imaginable.

The code is idiomatic.

Greg Hendershott

unread,
Nov 13, 2013, 10:26:53 AM11/13/13
to Lawrence Bottorff, users
I had exactly that choice to make a few years ago. I chose Racket
(well, PLT Scheme at the time). I'm very happy I did. At the time, my
reasons were:

- Racket seemed more consistently designed, CL felt more by-committee
(my impression)
- Racket seemed more pleasing to me esthetically. Including details
like `pred?` not `pred-p`.
- Single namespace (lisp1); contributes to the preceding, e.g no funcall #' jazz
- DrRacket IDE (at the time, simultaneously configuring and learning
emacs/slime felt like too much).
- Batteries-included libraries.

The last two helped me focus on more important things like, "where do
all these parentheses go?", and "how the heck am I supposed to loop
without mutation?", and so on. ;)

Those were my subjective impressions then. Without starting any flame
war I'd say they turned out to be largely accurate. Nothing is
perfect, but Racket has been a joy.

The more time I've spent with Racket, the more sense I can make out of
other lisps, so it turned out well overall.

Although there are some older deprecated parts, you probably won't
notice any "pork" as you put it.

If you get into certain corners of Racket like advanced macrology, you
may encounter a few things like
`splicing-expand-local-identifier-syntax-lifting-transformer`, but
that's an exaggerated example I completely made up :).

Seriously, Racket has turned out to be as clean, well-designed, and
fun to use as I first hoped.


On Tue, Nov 12, 2013 at 11:56 AM, Lawrence Bottorff <bor...@gmail.com> wrote:

Hendrik Boom

unread,
Nov 13, 2013, 11:37:40 AM11/13/13
to us...@racket-lang.org
On Wed, Nov 13, 2013 at 03:12:59AM +0100, Tomasz Rola wrote:
> On Tue, 12 Nov 2013, Hendrik Boom wrote:
>
> > On Tue, Nov 12, 2013 at 10:56:09AM -0600, Lawrence Bottorff wrote:
> > > I'm your typical newbie who is hand-wringing over what direction to go in
> > > the general functional programming world. Lisp, Scheme, or Haskell?
> > >
> [...]
> > >
> > > I understand that Barski is slavishly following the "let's get real stuff
> > > done" philosophy, but I'm not up to speed with functional yet to even know
> > > what's going on. Is your "Realm of Racket" better at this? I feel like I'm
> > > spinning my wheels at this point. . . .
> > >
> > > LB
> >
> > I should mention that another, quite different approach to functional
> > programming is the language OCAML. See http://ocaml.org/ for details.
> >
> > I program using Scheme and OCAML as high-level languages.

Well, actually, I also use Modula 3, that's a copletely different kind
of language. And I have some code in C/C++ as well. My code in those
languages is hardly functional at all.

> I may be very much wrong, so I cowardly apologise in advance, but I
> happened to subscribe to certain Haskell related NGs just in time to
> witness, kind of, interesting exchange there. In short, some
> incompatibilities were introduced into ghc (AFAIR) and this rendered some
> (a lot?) of working code uncompilable.

OCaml is not Haskell. Not remotely. Ocaml is *not* a vehicle for
research into lazy evaluation of purely functinoal code.

> I did not follow it to the very
> end, because at one point I simply lost interest. The tone I remember was
> "what, they can't update their code to agree with new compiler - too bad,
> let's drop the ballast and move on". My conclusion was, Haskell was still
> in the making. So if I decided to use it, I should be prepared to rewrite
> my code from time to time. And this is exactly the thing I hate - I hate
> rewriting the code, be it from one language to another "cooler" language
> or from dialect to dialect or from one program fragment to another. I
> really appreciate attitude of gcc compiler, which, at least in theory,
> allows me to compile very old code without a problem [1].

Except gcc does try to keep up with the C standard, which does get
revised now and then.

>
> I'm not sure if Ocaml is more like gcc or more like ghc, but I decided to
> learn it rather than H*.

It's an applicative language with some imperative features. I'm not a
masochist; I use the imperative features when appropriate. If you want
to look at something I wrote last year, I entered the liberated pixel
cup challenge (http://lpc.opengameart.org/) last year with an attempt
at a video game. I spent the month I had (re)learning OpenGL, learning
Ocaml, and putting together something that actually ran, and can keep
me amused for maybe five or ten minutes. I didn't win the liberated
pixel cup, nor did I expect to. My code is available at
http://topoi.pooq.com/hendrik/dv/free/fun/wander/index.html
Have fun. You'll need some obscure development libraries to run it.

>
> As of Racket vs CL, I think they are very comparable, with CL's one leg
> stuck in prehistory (the filesystem concept scared the bejesus out of me,
> almost) and Racket being modern and a bit alien to me, who licked (shyly)
> Dybvig's book in times of R4RS... But, the docs are great, so I can
> actually fire up drracket, google for some pointers in the docs and write
> code in, say, quarter hour or a few. Batteries included, thanks a lot for
> them :-). So for a beginner, Racket is a very good choice. Ability to use
> some Scheme introductory material, complete with real R5RS mode (it is
> fully compatible, isn't it :-) ), is great bonus, because it allows for
> more choices - I am trying to tutor my sister (already graduated, so
> English and logic is not a problem), and the choice of first intro book to
> programming is crucial. SICP have just been toppled down, now I am on the
> look again :-).
>
> (OTOH, I'm not sure if I'd want to write compiler in Racket. Maybe. For a
> while, I want to use both CL and R* and see what happens.)

Scheme is a lot better than many languages for writing a compiler,
actually. I'd certainly prefer it to C or C++. Recently I've noticed
compilers being written in OCaml, which seems well-suited to it.

> > By the way, I don't do exclusively pure functional programming. Most
> > of my code is functional, but I use imperative mechanisms when
> > apppropriate. I consider that building real systems as pure
> > functional code is extremism bordering on masochism.
>
> Yes. One more reason to rethink using Haskell, I guess... Pure functional
> looks cool in theory and blogs but in every day get-stuff-done it might be
> not so cool and pure anymore, at least in my case. Besides, I understand
> that the need for monads makes it dirty functional. So I play it safe. Of
> course I don't mean Haskell is bad or wrong choice. It just is not the
> best choice for every problem, but I guess I will learn it, some time
> later.
>
> [1] I wanted to quickly prove it with some code I downloaded in 1995, but
> gcc complained about "redefined identifiers" and stuff, so in practice
> some rewriting is required here, too (yes, I gave it "-ansi" but maybe
> there is some more options to experiment with, maybe I will).

A lot of people use gcc with -Wall which is quite helpful for catching
bugs.

> Regards,
> Tomasz Rola

-- hendrik

Tomasz Rola

unread,
Nov 13, 2013, 4:25:04 PM11/13/13
to us...@racket-lang.org
On Wed, 13 Nov 2013, Hendrik Boom wrote:

[...]
> OCaml is not Haskell. Not remotely. Ocaml is *not* a vehicle for
> research into lazy evaluation of purely functinoal code.

Yeah, this expectation actually drove me to Ocaml.

[...]
> pixel cup, nor did I expect to. My code is available at
> http://topoi.pooq.com/hendrik/dv/free/fun/wander/index.html
> Have fun. You'll need some obscure development libraries to run it.

Cool, I have a liking for 3d generated landscapes, composed of green grass
and blue heavens :-). Will have a look, thank you.

[...]
> > (OTOH, I'm not sure if I'd want to write compiler in Racket. Maybe. For a
> > while, I want to use both CL and R* and see what happens.)
>
> Scheme is a lot better than many languages for writing a compiler,
> actually. I'd certainly prefer it to C or C++. Recently I've noticed
> compilers being written in OCaml, which seems well-suited to it.

Well, it may be better, if you mean Racket - to be sure I would have to
use it for some bigger project (bigger than quick hack). Old style, R5RS
Scheme, without certain stuff I would like to have, like hash tables, is
not too much better IMHO (sure, I can write this stuff or find it on the
net/SRFIs/slib etc but I would rather have most of it built in from the
beginning). I have just looked around, and actually C is used quite often.

ocaml - mix of Ocaml and C

ghc - prototyped in ML, nowadays Haskell and some C for bootstraping

gcc - without looking inside I guess C and maybe something else like
assembly

javac - I will not bet but last time I cared it was written in C, I
suppose

chicken - Scheme, albeit distro tar includes C-files generated from scm
sources, to ease compilation

stalin - Scheme

kawa - mostly Java with some *.scm files

racket - looks like plenty of C with some *.rkt here and there

sbcl - full of CL files, requires working CL to build

fpc - looks like Pascal and assembly

pugscc - prototype Perl6 compiler in Haskell

So, it seems C is used for projects which started earlier in history and
when they could, they switched to be self hosting. Thus Scheme ends up
being used to write its own compilers, at best.

I guess the time when one could use Scheme for such task is mostly past.
We will have to wait a bit before we see Scheme used for writing some
_big_ project again. Perhaps Racket will change this. I mean, for the
better :-).

Regards,
Tomasz Rola

--
** A C programmer asked whether computer had Buddha's nature. **
** As the answer, master did "rm -rif" on the programmer's home **
** directory. And then the C programmer became enlightened... **
** **
** Tomasz Rola mailto:tomas...@bigfoot.com **

Hendrik Boom

unread,
Nov 13, 2013, 4:59:33 PM11/13/13
to us...@racket-lang.org
On Wed, Nov 13, 2013 at 10:25:04PM +0100, Tomasz Rola wrote:
> On Wed, 13 Nov 2013, Hendrik Boom wrote:
> >
> > Scheme is a lot better than many languages for writing a compiler,
> > actually. I'd certainly prefer it to C or C++. Recently I've noticed
> > compilers being written in OCaml, which seems well-suited to it.

In particular, there's Algol W, C-- (a code-generating back end),
and, I suppose, Ocaml itself, all written substantially in Ocaml.

>
> Well, it may be better, if you mean Racket - to be sure I would have to
> use it for some bigger project (bigger than quick hack). Old style, R5RS
> Scheme, without certain stuff I would like to have, like hash tables, is
> not too much better IMHO (sure, I can write this stuff or find it on the
> net/SRFIs/slib etc but I would rather have most of it built in from the
> beginning). I have just looked around, and actually C is used quite often.

If you're going to make a list, you might as well put
gambit/c on it. It's a Scheme compiler written in itself and
generating C code. Very portable.

-- hendrik
Reply all
Reply to author
Forward
0 new messages