Re: Amazon used lisp & C exclusively?
- From: Pascal Bourguignon <pjb@xxxxxxxxxxxxxxxxx>
- Date: Sun, 09 Jul 2006 23:24:49 +0200
Ari Johnson <iamtheari@xxxxxxxxx> writes:
I think that there are a few barriers to entry when it comes to Lisp
and, in particular, Common Lisp. Watch any Lisp newbie and you'll see
a few of them in action.
The first one is picking a Lisp. There are multiple implementations
of CL as well as multiple Schemes among which to choose. That's
barrier #1.
Let's assume that someone picks CL and decides on an implementation.
What does installing that implementation (either from its own binary
distribution package or from a Linux distribution; let's assume
apt-get install sbcl) actually give the user? Not much, in any sense
that he's used to. Conceptually, Lisp is so different that this forms
another barrier to entry in the user's mind. #2.
Now that you have a Lisp installed, you need to figure out how to do
useful things with it. The first thing you need to figure out how to
do is a hello world. In the majority of programming languages, this
consists of one of the following two processes:
1. Create source file with code in it. Compile source file. Run
resulting executable file.
Sorry, I don't see the difference with for example C:
[pjb@thalassa tmp]$ cat > example.lisp <<EOF
(defun fact (x) (if (<= x 1) 1 (* x (fact (1- x)))))
(defun main ()
(format *query-io* "~&Enter a positive integer:")
(let ((n (read *query-io*)))
(if (integerp n)
(format *standard-output* "~&~D! = ~D~%" n (fact n))
(format *error-output* "~&~S is not an integer~%")))
(ext:exit 0))
EOF
[pjb@thalassa tmp]$ clisp -i example.lisp \
-x '(ext:saveinitmem "example" :executable t :norc t :quiet t
:init-function (function main))'
;; Loading file /home/pjb/.clisprc.lisp ...
;; Reading ASDF packages from /home/pjb/asdf-central-registry.data...
; loading system definition from /usr/local/share/lisp/packages/net/sourceforge/cclan/asdf-install/asdf-install.asd into #<PACKAGE ASDF0>
; registering #<SYSTEM ASDF-INSTALL #x2048BF3E> as ASDF-INSTALL
0 errors, 0 warnings
;; Loading file example.lisp ...
;; Loaded file example.lisp
3652616 ;
912614
[pjb@thalassa tmp]$ [pjb@thalassa tmp]$ ./example
Enter a positive integer:15
15! = 1307674368000
[pjb@thalassa tmp]$ cat > example.c <<EOF
#include <stdio.h>
int fact(int x){if(x<=1){return(1);}else{return(x*fact(x-1));}}
int main(void){
printf("\nEnter a positive integer:");
{int n;
if(scanf("%d",&n)==1){
printf("\n%d! = %d\n",n,fact(n));
}else{
fprintf(stderr,"\nInput data is not an integer\n");
}
return(0);
}}
EOF
[pjb@thalassa tmp]$ gcc -o example example.c
[pjb@thalassa tmp]$ ./example
Enter a positive integer:15
15
15! = 2004310016
[pjb@thalassa tmp]$
That is, beside the fact that in lisp you have more options to
generate the executable than in C, and that the lisp version gives
correct results...
2. Create source file with code in it. Chmod 755. Run source file.
I fail to see the difference with bash or any other scripting language...
[pjb@thalassa tmp]$ cat > example <<EOF
#!/usr/local/bin/clisp -ansi -q
(format t "Hello World!")
EOF
[pjb@thalassa tmp]$ chmod 755 example
[pjb@thalassa tmp]$ ./example
Hello World!
[pjb@thalassa tmp]$ cat > example <<EOF
#!/bin/bash
printf "Hello World!\n"
EOF
[pjb@thalassa tmp]$ chmod 755 example
[pjb@thalassa tmp]$ ./example
Hello World!
[pjb@thalassa tmp]$
Neither of these applies directly to Lisp, and that is why you get so
many questions of the form "How do I compile my Lisp file into an
executable?" and of the form "How do I run my Lisp script?" This is
barrier #3.
Bull ***.
Next up, once the newbie figures out the REPL, he still wants to use
process 1 or 2 above. This is obnoxious and he doesn't think that
Lisp gets him anything in the way of workflow that Ruby, Python, Perl,
or even C doesn't already provide. Barrier #4.
Well, this is more a pedagogical problem than anything else. What are
the teachers doing?
So we show him SLIME. It's nifty, but how much difference is there
between the following?
Edit, Save, Compile, Switch to REPL, Run
-and-
Edit, Save, Switch to shell, [Compile,] Run
Oh? You switch to the REPL? I just use C-x C-e, directly from the
source buffer, so it's more like:
Edit, Run. (and if it's OK, Save).
[...]
It really has very little to do with having a killer app, IMHO.
--
__Pascal Bourguignon__ http://www.informatimago.com/
IMPORTANT NOTICE TO PURCHASERS: The entire physical universe,
including this product, may one day collapse back into an
infinitesimally small space. Should another universe subsequently
re-emerge, the existence of this product in that universe cannot be
guaranteed.
.
- Follow-Ups:
- Re: Amazon used lisp & C exclusively?
- From: Ari Johnson
- Re: Amazon used lisp & C exclusively?
- References:
- Amazon used lisp & C exclusively?
- From: Alok
- Re: Amazon used lisp & C exclusively?
- From: Frank Buss
- Re: Amazon used lisp & C exclusively?
- From: Ken Tilton
- Re: Amazon used lisp & C exclusively?
- From: William James
- Re: Amazon used lisp & C exclusively?
- From: Pascal Bourguignon
- Re: Amazon used lisp & C exclusively?
- From: David Steuber
- Re: Amazon used lisp & C exclusively?
- From: Alok
- Re: Amazon used lisp & C exclusively?
- From: Mallor
- Re: Amazon used lisp & C exclusively?
- From: Ari Johnson
- Amazon used lisp & C exclusively?
- Prev by Date: Re: Amazon used lisp & C exclusively?
- Next by Date: Re: Amazon used lisp & C exclusively?
- Previous by thread: Re: Amazon used lisp & C exclusively?
- Next by thread: Re: Amazon used lisp & C exclusively?
- Index(es):