Re: Scheme as a religion
- From: "Jérémie Lumbroso" <jeremie.lumbroso@xxxxxxxxx>
- Date: 6 Jan 2006 16:22:07 -0800
[Phew ... I spent over an hour and half catching up on this colorful
conversation (silently sad I couldn't pitch in at the beginning).]
I'm a newcomer to Scheme. (Please I apologize in advance for rambling;
if you can't stand it, skip to the '****')
I started programming early, on Apple's Hypercard because my family had
an established tradition of being Apple-only---until that tradition was
stuffed, and my dad got a PC with the just-out Win95, and I went on
using VB.
As I had become increasingly stiffled by VB (Microsoft still considered
it a sort-of toy language, and it made it very hard to access Win's API
or DirectX, etc.), I switched to C/C++, and then later on to C# (when
it came out). C# was something of a revelation to me. Why? Because I'd
got more and more concerned about the elegance of my code, and I
believed that, as far as OO languages went, C# (along with MS' .NET
framework) was far more elegant than C/C++ and Java. Not that I'm
deluding myself in comparing their worth, but to me, at the time, the
brand new C# had a consistency that I found lacked in other languages
(but of course the consistency came from the fact that C# had not yet
lived through a generation of demanding programmers).
I've evolved in C#, by pathologically rewriting everything. I have the
rewriting disease, that I'm sure all of you know about (and only the
best of you have conquered): I write a program, then start rewriting it
before it reaches final stage, then rewrite that rewrite before it
reaches final stage, etc. ad nauseum.
Well, the programming language of my university's introductory
programming course happens to be Scheme. I learned Scheme very quickly,
because I've reached that point where you've tried out so many
programming languages that they start, basically, all looking
superficially alike (at least the basic concepts). And I have come to
love it a lot.
And more importantly, Scheme triggered a desire to use functional
languages as much as possible (to such an extent that my computer is
now the home to interpreters for most popular functional
languages-and in several cases, more than one interpreter!).
To explain this, I'll also add that in the past few years, my interest
in maths has soared. I'm not sure why. To the extent that it is now
*so* refreshing and liberating, to find programming languages such as
Scheme or Haskell, that try to approach that mathematical abstraction.
That is why I've come to love functional programming.
****
Now, *FIRST OF ALL*, H., I want to stress the fact that my enthusiasm
would probably not have been as strong had I not been spoon-fed with
DrScheme ( http://www.drscheme.org/ ), and incredibly implementation of
Scheme. I'm not sure if you know it, but if you don't, you'll like it
for these reasons (among others):
* it runs smoothly out of the box;
* it features a full-fledge integrated development environment, with
editor and "live" interpreter;
* it makes the whole parenthesis thing almost beautiful, because it
handles indentation and syntax coloring so well.
Second, I read you asking something about why Scheme does something
different whether you put parenthesis or not. It think I may have
either read into the question something that you did not actually ask,
but here's my comment:
; a function
(define (hello-world)
(display "Hello world!"))
Were you finding it weird that:
hello-world
And:
(hello-world)
.... are not the same thing? Well, actually that is one thing that I
find extremely impressive and awe-inspiring about Scheme. Admitedly, a
lot of imperative languages are now implementing anonymous functions
(and C# is getting it's very own lambda and closures in the next
version), but that seems to be in response to the success they are
getting in functional languages.
(This is not an expert's point of view, BTW.)
Functions are object. "hello-world" is an object. But Lisp's syntax has
it that you have the construct (<function> <arguments>) which is
universal safe for the "special forms"; this makes sense, as it is kind
of like maths f(x,y,z) where first the name of the function appears
then the arguments. Like in maths, "f" is a function, and "f(x,y,z)" or
"f()" (if it were actually possible, and semantically correct to have a
parameterless function) are images of said-parameters by the function.
I find it very useful to have functions treated as objects; for
instance you can have lists of functions, or list of list of functions,
or whatever.
I actually have a somewhat decent example of this I wrote, of a scholar
implementation of the Gaussian reduction algorithm in Scheme, in which
the challenge I'd set myself was to not use an inkling of imperative
programming-and in effect, the entire program is (almost) all
recursive.
In it, the main function operates on a coefficient matrix, and outputs
a list of primitives (+ - * /) with a few arguments (+ 5, + 6, / 5,
etc.)---those primitive operations which were necessary to reduce the
matrix.
That list of primitives is then "applied" to the constant matrix (the
values of second member of the linear system) to calculate values of
the unknowns. In short, for a given linear system, you only have to
calculate the list of primitives once, and then you can apply it
however many times you want to different constant matrices.
But I (considerably) digress ...
OK, in a nutshell what got my panties in a twist: Scheme is a
functional language that is much closer to maths than C, C++, Java,
etc. Outside a nutshell (oh, I know, I'm a Groucho copy-cat!): download
DrScheme.
I'll try to collect my thoughts and write something that's up to par
with any of the other contributors (or at least honorably trying to
be).
Regards,
Jérémie
(jeremie.lumbroso gmail com)
.
- Follow-Ups:
- Re: Scheme as a religion
- From: H.
- Re: Scheme as a religion
- References:
- Scheme as a religion
- From: H.
- Re: Scheme as a religion
- From: Giorgos Keramidas
- Re: Scheme as a religion
- From: Brian Harvey
- Re: Scheme as a religion
- From: H.
- Re: Scheme as a religion
- From: Brian Harvey
- Re: Scheme as a religion
- From: H.
- Scheme as a religion
- Prev by Date: Re: Scheme as a religion
- Next by Date: Re: Scheme as a religion
- Previous by thread: Re: Scheme as a religion
- Next by thread: Re: Scheme as a religion
- Index(es):
Relevant Pages
|