all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Learning LISP; Scheme vs elisp.
@ 2008-08-01 12:45 Adam Funk
  2008-08-01 13:06 ` Joost Kremers
                   ` (7 more replies)
  0 siblings, 8 replies; 14+ messages in thread
From: Adam Funk @ 2008-08-01 12:45 UTC (permalink / raw)
  To: help-gnu-emacs

I've decided I ought to train myself in the most elegant programming
weapon --- http://xkcd.com/297/ --- so I've started working through
_The Structure and Interpretation of Computer Programs_.

In the long term I hope I'll be able to customize Emacs more in its
native way instead of wrapping external Perl programs in
shell-command-on-region (as I often do now).

Any tips on transferring knowledge between Scheme and elisp?

As a first observation, it seems to me that Scheme's define seems to
correspond to both defun and setq in elisp --- is that a fair
interpretation (or a stupid one)?


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Learning LISP; Scheme vs elisp.
  2008-08-01 12:45 Learning LISP; Scheme vs elisp Adam Funk
@ 2008-08-01 13:06 ` Joost Kremers
  2008-08-01 20:26   ` Adam Funk
  2008-08-01 14:09 ` Thien-Thi Nguyen
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Joost Kremers @ 2008-08-01 13:06 UTC (permalink / raw)
  To: help-gnu-emacs

Adam Funk wrote:
> I've decided I ought to train myself in the most elegant programming
> weapon --- http://xkcd.com/297/ --- so I've started working through
> _The Structure and Interpretation of Computer Programs_.
>
> In the long term I hope I'll be able to customize Emacs more in its
> native way instead of wrapping external Perl programs in
> shell-command-on-region (as I often do now).

dunno, but the emacs lisp intro (C-h i m emacs lisp intro RET) and the
emacs lisp manual (C-h i m elisp RET) seem more appropriate ways to get
started with elisp...


-- 
Joost Kremers                                      joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Learning LISP; Scheme vs elisp.
  2008-08-01 12:45 Learning LISP; Scheme vs elisp Adam Funk
  2008-08-01 13:06 ` Joost Kremers
@ 2008-08-01 14:09 ` Thien-Thi Nguyen
  2008-08-01 19:16 ` Joel J. Adamson 
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Thien-Thi Nguyen @ 2008-08-01 14:09 UTC (permalink / raw)
  To: Adam Funk; +Cc: help-gnu-emacs

() Adam Funk <a24061@ducksburg.com>
() Fri, 1 Aug 2008 13:45:57 +0100

   most elegant programming weapon

warriors attack, felling foe after foe,
few growing old til they realize: to know
what deceit is worth deflection;
such receipt reversed rejection!
then their heavy arms, e'er transformed to shields:
balanced hooked charms, ploughed deep, rich yields.

thi




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Learning LISP; Scheme vs elisp.
  2008-08-01 12:45 Learning LISP; Scheme vs elisp Adam Funk
  2008-08-01 13:06 ` Joost Kremers
  2008-08-01 14:09 ` Thien-Thi Nguyen
@ 2008-08-01 19:16 ` Joel J. Adamson 
       [not found] ` <mailman.15727.1217618719.18990.help-gnu-emacs@gnu.org>
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Joel J. Adamson  @ 2008-08-01 19:16 UTC (permalink / raw)
  To: Adam Funk; +Cc: help-gnu-emacs

>>>>> "Adam" == Adam Funk <a24061@ducksburg.com> writes:

    Adam> I've decided I ought to train myself in the most elegant
    Adam> programming weapon --- http://xkcd.com/297/ --- so I've
    Adam> started working through _The Structure and Interpretation of
    Adam> Computer Programs_.

    Good idea: the best computer science book ever written --- and the only
    one I've ever used :-P

    Adam> In the long term I hope I'll be able to customize Emacs more
    Adam> in its native way instead of wrapping external Perl programs
    Adam> in shell-command-on-region (as I often do now).

    Uh, what?  Can you explain this?  Can you explain why on Earth you
    would do it?

    Adam> Any tips on transferring knowledge between Scheme and elisp?

    There are some general qualities to Lisp that all Lisp dialects
    share, Scheme and Emacs Lisp among them.  Both are descendants of
    MacLisp (though Scheme is way different from MacLisp, and Emacs Lisp
    is quite similar).

    Adam> As a first observation, it seems to me that Scheme's define
    Adam> seems to correspond to both defun and setq in elisp --- is
    Adam> that a fair interpretation (or a stupid one)?

    Scheme has a single namespace for variables and functions, whereas
    other Lisps have one for functions, one for special variables, on
    and on.  That's why there's defun, defvar, defmacro, defkitten; this
    is how you can pass a function as a variable without specially
    tagging it in Scheme:

    Scheme:

,----
| Gambit v4.2.8
| 
| > (define lis '(1 2 3 4))
|   (apply + lis)
| > 10
`----

    Emacs:
    
,----
| ELISP> (apply + '(1 2 3 4))
| *** Eval error ***  Symbol's value as variable is void: +
| ELISP> (apply '+ '(1 2 3 4))
| 10  
`----

    Common Lisp:
    
,----
| [5]>     (defvar lis '(1 2 3 4))
| LIS
| [6]> lis
| (1 2 3 4)
| [7]> (apply #'+ lis)
| 10
| [8]> (apply + lis)
| 
| *** - APPLY: (APPLY #'+ LIS) is not a function name; try using a symbol instead
| The following restarts are available:
| USE-VALUE      :R1      You may input a value to be used instead.
| ABORT          :R2      ABORT
| Break 1 [9]> 
`----

Read those errors carefully and they'll make sense given what I said
above about namespaces.

The real correspondent of setq in Scheme is set! --- destructive
procedures end in exclamation points.   It's up to a particular
implementor of Scheme as to whether set! on an undefined
variable is an error (correct me if I'm wrong about the standard, but
I've had some implementations where you can set! an un'define'd
variable, and others where you can't).

I suggest you use Emacs for Scheme hacking, and that way you will learn
the ins and outs of both.  If you'd like to see an application that I
developed in Emacs using Scheme (and that I'd like to add an Emacs mode
for interacting), check out http://www.unc.edu/~adamsonj/software.html
and scroll down to Intelligent WTF.  The source code is also there for
browsing.

Joel




-- 
Joel J. Adamson
(303) 880-3109
Public key: http://pgp.mit.edu
http://www.unc.edu/~adamsonj
http://trashbird1240.blogspot.com




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Learning LISP; Scheme vs elisp.
       [not found] ` <mailman.15727.1217618719.18990.help-gnu-emacs@gnu.org>
@ 2008-08-01 20:18   ` David Kastrup
  2008-08-04  2:31     ` Joel J. Adamson 
  2008-08-01 20:30   ` Adam Funk
  2008-08-01 22:10   ` Pascal J. Bourguignon
  2 siblings, 1 reply; 14+ messages in thread
From: David Kastrup @ 2008-08-01 20:18 UTC (permalink / raw)
  To: help-gnu-emacs

"Joel J. Adamson " <adamsonj@email.unc.edu> writes:

>>>>>> "Adam" == Adam Funk <a24061@ducksburg.com> writes:
>
>     Adam> I've decided I ought to train myself in the most elegant
>     Adam> programming weapon --- http://xkcd.com/297/ --- so I've
>     Adam> started working through _The Structure and Interpretation of
>     Adam> Computer Programs_.
>
>     Scheme:
>
> ,----
> | Gambit v4.2.8
> | 
> | > (define lis '(1 2 3 4))
> |   (apply + lis)
> | > 10
> `----
>
>     Emacs:
>     
> ,----
> | ELISP> (apply + '(1 2 3 4))
> | *** Eval error ***  Symbol's value as variable is void: +
> | ELISP> (apply '+ '(1 2 3 4))
> | 10  
> `----

That's actually not the same because apply then gets a quoted symbol
rather than a dereferenced function cell.  The equivalent would be
(apply (symbol-function '+) '(1 2 3 4))

Check this:

guile> +
#<primitive-generic +>

ELISP> '+
+
ELISP> (symbol-function '+)
#<subr +>


>
>     Common Lisp:

> | [7]> (apply #'+ lis)
> | 10

Works in Emacs as well, obviously.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Learning LISP; Scheme vs elisp.
  2008-08-01 13:06 ` Joost Kremers
@ 2008-08-01 20:26   ` Adam Funk
  0 siblings, 0 replies; 14+ messages in thread
From: Adam Funk @ 2008-08-01 20:26 UTC (permalink / raw)
  To: help-gnu-emacs

On 2008-08-01, Joost Kremers wrote:

> Adam Funk wrote:
>> I've decided I ought to train myself in the most elegant programming
>> weapon --- http://xkcd.com/297/ --- so I've started working through
>> _The Structure and Interpretation of Computer Programs_.
>>
>> In the long term I hope I'll be able to customize Emacs more in its
>> native way instead of wrapping external Perl programs in
>> shell-command-on-region (as I often do now).
>
> dunno, but the emacs lisp intro (C-h i m emacs lisp intro RET) and the
> emacs lisp manual (C-h i m elisp RET) seem more appropriate ways to get
> started with elisp...

Well, what I mainly want to do is learn LISP from a reputable text,
and I'm hoping a side benefit of that will be improved Emacs skills.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Learning LISP; Scheme vs elisp.
       [not found] ` <mailman.15727.1217618719.18990.help-gnu-emacs@gnu.org>
  2008-08-01 20:18   ` David Kastrup
@ 2008-08-01 20:30   ` Adam Funk
  2008-08-01 22:10   ` Pascal J. Bourguignon
  2 siblings, 0 replies; 14+ messages in thread
From: Adam Funk @ 2008-08-01 20:30 UTC (permalink / raw)
  To: help-gnu-emacs

On 2008-08-01, Joel J. Adamson wrote:

>    Adam> I've decided I ought to train myself in the most elegant
>    Adam> programming weapon --- http://xkcd.com/297/ --- so I've
>    Adam> started working through _The Structure and Interpretation of
>    Adam> Computer Programs_.
>
>     Good idea: the best computer science book ever written --- and the only
>     one I've ever used :-P

Good!

>    Adam> In the long term I hope I'll be able to customize Emacs more
>    Adam> in its native way instead of wrapping external Perl programs
>    Adam> in shell-command-on-region (as I often do now).
>
>     Uh, what?  Can you explain this?  Can you explain why on Earth you
>     would do it?

If you mean why do I do such a hideous thing now, it's because I *can*
do string manipulation in Perl, whereas I can't (currently) do it in
LISP (except for fairly trivial cases).

Thanks for the rest of the information, which it will take a little
while for me to digest.  (I suspected my initial understanding of
define's equivalents might be naïve.)


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Learning LISP; Scheme vs elisp.
  2008-08-01 12:45 Learning LISP; Scheme vs elisp Adam Funk
                   ` (3 preceding siblings ...)
       [not found] ` <mailman.15727.1217618719.18990.help-gnu-emacs@gnu.org>
@ 2008-08-01 21:51 ` Pascal J. Bourguignon
  2008-08-02  1:06   ` weber
  2008-08-02 12:33 ` Xah
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Pascal J. Bourguignon @ 2008-08-01 21:51 UTC (permalink / raw)
  To: help-gnu-emacs

Adam Funk <a24061@ducksburg.com> writes:

> I've decided I ought to train myself in the most elegant programming
> weapon --- http://xkcd.com/297/ --- so I've started working through
> _The Structure and Interpretation of Computer Programs_.

Notice that this is not a book about scheme, but about programming in
general.  It just happens that it uses scheme for its examples (but
there are blogs and wikis with the sicp examples translated in other
programming languages).
http://codepoetics.com/wiki/index.php?title=Topics:SICP_in_other_languages
http://eli.thegreenplace.net/category/programming/lisp/sicp/

To learn scheme there are easier books such as:

         How to Design Programs -- An Introduction to Computing and Programming
         http://www.htdp.org/2003-09-26/Book/  

         Concrete Abstractions -- An Introduction to Computer Science Using Scheme
         http://www.gustavus.edu/+max/concrete-abstractions.html

And of course, the reference:
http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs.html
and documentation of the implementation, eg. http://www.drscheme.org/
A new version of scheme just came out, R6RS http://schemers.org/
so be sure to use the version of the report implemented by your scheme.


Nonetheless, SICP is a very good book that you should read anyways,
but it will teach you more general and very important concepts, beyond
the specific knowledge of scheme details.



> In the long term I hope I'll be able to customize Emacs more in its
> native way instead of wrapping external Perl programs in
> shell-command-on-region (as I often do now).

Yuck!


> Any tips on transferring knowledge between Scheme and elisp?

Emacs lisp is closer to Common Lisp than scheme.  The main separation
line being this lisp-1 vs. lisp-2 affair.  But emacs lisp is also
different enough from Common Lisp (the main difference being that all
emacs lisp variables are special, while all scheme variables are
lexical; in Common Lisp, there are both lexical and special
variables).

The fundamental lisp "primitives" will be about the same in all lisp
languages.  You will have (eql (car (cons x y)) x) in all lisp, well
(eqv? (car (cons x y)) x) in scheme.  But details may be different
enough that it might be difficult to write code running with the same
semantics or at all on both three.

For example:

(let ((a 1) (b 2) (c -1))
  (do ((x 0 (+ 1 x)))
      ((> x 10))
   (print (+ c (* b (+ x (* a x)))))))

will do about the same thing in emacs lisp and Common Lisp. For
scheme, you will have to (define (print x) (newline) (display x)), but
scheme will return #t, while Common Lisp returns NIL (and emacs lisp
nil, since in emacs lisp the symbols are in lowcase by default
contrarily to Common Lisp).


Once you know well one of them, including their macro system, you will
be able to write "portability"  function like the above print
function.  In emacs lisp, there is the cl library (require 'cl) which
exports some functions and macros found in Common Lisp and not in
emacs lisp. 

Also, there are implementations of one in the other. For example:
emacs-cl implements Common Lisp over emacs lisp.
Pseudo   implements scheme r4rs over Common Lisp.

( Someone could have good fun trying to make Pseudo run over emacs-cl
over emacs lisp, to have a scheme in emacs ;-) )


But the main thing, with respect to emacs lisp is that if you want to
learn it for emacs editing, then you will have to learn all the emacs
"library" functions. Things about buffers, markers, files, windows,
characters, inserting, deleting, replacing, regular expressions, etc,
not mentionning all the emacs lisp libraries and applications.  This
is an amount of knowledge orders of magnitude superior to the mere
knowledge of the programming language.  (Don't be afraid, happily you
don't have to learn it all at once, you can learn it piece by piece
when you need it).


You could learn emacs lisp from the emacs-lisp-intro tutorial, and
translate the sicp examples in emacs lisp. It's already been done for
Common Lisp, but not for emacs lisp.


Finally, I should mention that you could skip emacs lisp altogether,
learn Common Lisp, and use an emacs implemented in Common Lisp, such
as Hemlock, or the more recent Climacs (but they don't benefit (yet)
the same amount of contributions as emacs).


> As a first observation, it seems to me that Scheme's define seems to
> correspond to both defun and setq in elisp --- is that a fair
> interpretation (or a stupid one)?

As a first approximation, you're right.

For more information see: 

http://groups.google.com/groups?as_q=lisp-1+lisp-2&num=100&scoring=r&as_epq=&as_oq=&as_eq=&as_ugroup=comp.lang.lisp&as_usubject=&as_uauthors=&lr=&as_drrb=q&as_qdr=&as_mind=1&as_minm=1&as_miny=1981&as_maxd=1&as_maxm=8&as_maxy=2008&safe=off


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Until real software engineering is developed, the next best practice
is to develop with a dynamic system that has extreme late binding in
all aspects. The first system to really do this in an important way
is Lisp. -- Alan Kay


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Learning LISP; Scheme vs elisp.
       [not found] ` <mailman.15727.1217618719.18990.help-gnu-emacs@gnu.org>
  2008-08-01 20:18   ` David Kastrup
  2008-08-01 20:30   ` Adam Funk
@ 2008-08-01 22:10   ` Pascal J. Bourguignon
  2 siblings, 0 replies; 14+ messages in thread
From: Pascal J. Bourguignon @ 2008-08-01 22:10 UTC (permalink / raw)
  To: help-gnu-emacs

"Joel J. Adamson " <adamsonj@email.unc.edu> writes:
> I suggest you use Emacs for Scheme hacking, and that way you will learn
> the ins and outs of both. 

Oh yes, and be sure to use paredit.
http://mumble.net/~campbell/emacs/paredit.el

Here is a quick tutorial for using scheme in emacs:

C-x C-f ~/test.scm RET
C-x 2
C-u M-x inferior-lisp RET
C-a C-k mzscheme RET             -- assuming you have  mzscheme  in the PATH.
(display "Hello") RET
C-x o                            -- return to test.scm buffer.
(define (hw)
   (newline) (display "Hello") (newline)) C-x C-e
(hw) c-x C-e
                                 -- so you can keep your source and test 
                                 -- expressions in the scm buffer, and
                                 -- send the over to the inferior-lisp
                                 -- process for execution with C-x C-e.

Have fun!

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

"Our users will know fear and cower before our software! Ship it!
Ship it and let them flee like the dogs they are!"


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Learning LISP; Scheme vs elisp.
  2008-08-01 21:51 ` Pascal J. Bourguignon
@ 2008-08-02  1:06   ` weber
  0 siblings, 0 replies; 14+ messages in thread
From: weber @ 2008-08-02  1:06 UTC (permalink / raw)
  To: help-gnu-emacs

On Aug 1, 6:51 pm, p...@informatimago.com (Pascal J. Bourguignon)
wrote:
> Adam Funk <a24...@ducksburg.com> writes:
> > I've decided I ought to train myself in the most elegant programming
> > weapon ---http://xkcd.com/297/--- so I've started working through
> > _The Structure and Interpretation of Computer Programs_.
>
> Notice that this is not a book about scheme, but about programming in
> general.  It just happens that it uses scheme for its examples (but
> there are blogs and wikis with the sicp examples translated in other
> programming languages).http://codepoetics.com/wiki/index.php?title=Topics:SICP_in_other_lang...http://eli.thegreenplace.net/category/programming/lisp/sicp/
>
> To learn scheme there are easier books such as:
>
>          How to Design Programs -- An Introduction to Computing and Programming
>          http://www.htdp.org/2003-09-26/Book/ 
>
>          Concrete Abstractions -- An Introduction to Computer Science Using Scheme
>          http://www.gustavus.edu/+max/concrete-abstractions.html
>
> And of course, the reference:http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs.html
> and documentation of the implementation, eg.http://www.drscheme.org/
> A new version of scheme just came out, R6RShttp://schemers.org/
> so be sure to use the version of the report implemented by your scheme.
>
> Nonetheless, SICP is a very good book that you should read anyways,
> but it will teach you more general and very important concepts, beyond
> the specific knowledge of scheme details.
>
> > In the long term I hope I'll be able to customize Emacs more in its
> > native way instead of wrapping external Perl programs in
> > shell-command-on-region (as I often do now).
>
> Yuck!
>
> > Any tips on transferring knowledge between Scheme and elisp?
>
> Emacs lisp is closer to Common Lisp than scheme.  The main separation
> line being this lisp-1 vs. lisp-2 affair.  But emacs lisp is also
> different enough from Common Lisp (the main difference being that all
> emacs lisp variables are special, while all scheme variables are
> lexical; in Common Lisp, there are both lexical and special
> variables).
>
> The fundamental lisp "primitives" will be about the same in all lisp
> languages.  You will have (eql (car (cons x y)) x) in all lisp, well
> (eqv? (car (cons x y)) x) in scheme.  But details may be different
> enough that it might be difficult to write code running with the same
> semantics or at all on both three.
>
> For example:
>
> (let ((a 1) (b 2) (c -1))
>   (do ((x 0 (+ 1 x)))
>       ((> x 10))
>    (print (+ c (* b (+ x (* a x)))))))
>
> will do about the same thing in emacs lisp and Common Lisp. For
> scheme, you will have to (define (print x) (newline) (display x)), but
> scheme will return #t, while Common Lisp returns NIL (and emacs lisp
> nil, since in emacs lisp the symbols are in lowcase by default
> contrarily to Common Lisp).
>
> Once you know well one of them, including their macro system, you will
> be able to write "portability"  function like the above print
> function.  In emacs lisp, there is the cl library (require 'cl) which
> exports some functions and macros found in Common Lisp and not in
> emacs lisp.
>
> Also, there are implementations of one in the other. For example:
> emacs-cl implements Common Lisp over emacs lisp.
> Pseudo   implements scheme r4rs over Common Lisp.
>
> ( Someone could have good fun trying to make Pseudo run over emacs-cl
> over emacs lisp, to have a scheme in emacs ;-) )
>
> But the main thing, with respect to emacs lisp is that if you want to
> learn it for emacs editing, then you will have to learn all the emacs
> "library" functions. Things about buffers, markers, files, windows,
> characters, inserting, deleting, replacing, regular expressions, etc,
> not mentionning all the emacs lisp libraries and applications.  This
> is an amount of knowledge orders of magnitude superior to the mere
> knowledge of the programming language.  (Don't be afraid, happily you
> don't have to learn it all at once, you can learn it piece by piece
> when you need it).
>
> You could learn emacs lisp from the emacs-lisp-intro tutorial, and
> translate the sicp examples in emacs lisp. It's already been done for
> Common Lisp, but not for emacs lisp.
>
> Finally, I should mention that you could skip emacs lisp altogether,
> learn Common Lisp, and use an emacs implemented in Common Lisp, such
> as Hemlock, or the more recent Climacs (but they don't benefit (yet)
> the same amount of contributions as emacs).
>
> > As a first observation, it seems to me that Scheme's define seems to
> > correspond to both defun and setq in elisp --- is that a fair
> > interpretation (or a stupid one)?
>
> As a first approximation, you're right.
>
> For more information see:
>
> http://groups.google.com/groups?as_q=lisp-1+lisp-2&num=100&scoring=r&...
>
> --
> __Pascal Bourguignon__                    http://www.informatimago.com/
> Until real software engineering is developed, the next best practice
> is to develop with a dynamic system that has extreme late binding in
> all aspects. The first system to really do this in an important way
> is Lisp. -- Alan Kay

Aren't you guys exaggerating? Maybe he just need to pickup the basics
to start writing his functions?

Check the manual and this perhaps (http://steve-yegge.blogspot.com/
2008/01/emergency-elisp.html). If you have any specific doubts, ask on
gnu.emacs.help!

Cheers,
weber


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Learning LISP; Scheme vs elisp.
  2008-08-01 12:45 Learning LISP; Scheme vs elisp Adam Funk
                   ` (4 preceding siblings ...)
  2008-08-01 21:51 ` Pascal J. Bourguignon
@ 2008-08-02 12:33 ` Xah
  2008-08-02 13:51 ` Xah
       [not found] ` <mailman.15710.1217599959.18990.help-gnu-emacs@gnu.org>
  7 siblings, 0 replies; 14+ messages in thread
From: Xah @ 2008-08-02 12:33 UTC (permalink / raw)
  To: help-gnu-emacs

On Aug 1, 5:45 am, Adam Funk <a24...@ducksburg.com> wrote:
> I've decided I ought to train myself in the most elegant programming
> weapon ---http://xkcd.com/297/--- so I've started working through
> _The Structure and Interpretation of Computer Programs_.

Scheme being a beautiful lang is rather a myth.

Common Lisp wouldn't agree in any way.
Mathematica programer like myself will laugh at that thought.
Basically any modern functional lang will also laugh at the idea.

I myself, about 10 years ago, thought that Scheme is the most
beautiful lang, just like you, from reading the web forums and faqs,
as well read the SICP book in 1999 and r4rs. I wouldn't say Scheme is
in anyway beautiful or elegant. Even one of its quality, minimalism,
is completely screwed up in r6rs which happened last year.

See:

Proliferation of Computing Languages
http://xahlee.org/UnixResource_dir/writ/new_langs.html

Fundamental Problems of Lisp
http://xahlee.org/UnixResource_dir/writ/lisp_problems.html

How Purely Nested Notation Limits The Language's Utility
http://xahlee.org/UnixResource_dir/writ/notations.html

My First Encounter And Impression Of Lisp
http://xahlee.org/PageTwo_dir/Personal_dir/xah_comp_exp.html

> In the long term I hope I'll be able to customize Emacs more in its
> native way instead of wrapping external Perl programs in
> shell-command-on-region (as I often do now).
>
> Any tips on transferring knowledge between Scheme and elisp?

that doesn't make sense unless you are already a scheme expert and is
exposed to elisp for the first time. And in that case, all you need is
a one-page summary of major differences. I'm not aware there's one but
there are a couple that summarize the diff between Scheme and CL.
Elisp is close to CL, so that would help.

Since you seems new to both, the comparison won't mean much. You can
start with my elisp tutorial, if you are already a expert of a
language.

http://xahlee.org/emacs/elisp.html

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Learning LISP; Scheme vs elisp.
  2008-08-01 12:45 Learning LISP; Scheme vs elisp Adam Funk
                   ` (5 preceding siblings ...)
  2008-08-02 12:33 ` Xah
@ 2008-08-02 13:51 ` Xah
       [not found] ` <mailman.15710.1217599959.18990.help-gnu-emacs@gnu.org>
  7 siblings, 0 replies; 14+ messages in thread
From: Xah @ 2008-08-02 13:51 UTC (permalink / raw)
  To: help-gnu-emacs

On Aug 1, 5:45 am, Adam Funk <a24...@ducksburg.com> wrote:

> In the long term I hope I'll be able to customize Emacs more in its
> native way instead of wrapping external Perl programs in
> shell-command-on-region (as I often do now).

if all you need to do is text processing and perl currently satisfies
your needs, then what you are doing now is good enough. Trust me.
Learning elisp would be like waste of time.

however, elisp for text processing is actually more powerful, because
of the buffer datatype, where you can move cursor to and pro. (i.e. in
perl, you just slurp the text file so that you have a array of lines
or the whole file as a single string. In emacs, the whole file text is
a buffer, where you can move the index to arbirary points using
various highlevel functions such as regex. In perl, you can also move
the index in a file, but then you deal with the file as a stream and
bytes)

 As a concret example, suppose you need to do some simple manipulation
of nested text such as XML. In perl with regex, you quickly fail
because regex is unable to match nested syntax. You end up either with
covoluted solution or go full using a XML parser (at which point it
becomes rather complex and no longer text processing and you lose your
xml formatting)

But in elisp, because you deal with buffers, you can move cursor into
or out of nested text. So, you can still use text processing method to
do simple xml manipulation.

For concrete examples, see:

elisp lessens on text processing:
http://xahlee.org/emacs/elisp_text_processing.html
http://xahlee.org/emacs/elisp_process_html.html

text processing in elisp vs perl (essay)
http://xahlee.org/emacs/elisp_text_processing_lang.html

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Learning LISP; Scheme vs elisp.
  2008-08-01 20:18   ` David Kastrup
@ 2008-08-04  2:31     ` Joel J. Adamson 
  0 siblings, 0 replies; 14+ messages in thread
From: Joel J. Adamson  @ 2008-08-04  2:31 UTC (permalink / raw)
  To: David Kastrup; +Cc: help-gnu-emacs

>>>>> "dak" == David Kastrup <dak@gnu.org> writes:


    dak> That's actually not the same because apply then gets a quoted
    dak> symbol rather than a dereferenced function cell.  The
    dak> equivalent would be (apply (symbol-function '+) '(1 2 3 4))

Perhaps it was a poor example for presentation; I've never actually used
that sort of call in Emacs Lisp, as I mainly code in Scheme these days.
My point was about the single namespace in Scheme, whereas in other
Lisps there are multiple namespaces, to explain the differences between
define and defun, defmacro, defvar, etc.

Joel

-- 
Joel J. Adamson
(303) 880-3109
Public key: http://pgp.mit.edu
http://www.unc.edu/~adamsonj
http://trashbird1240.blogspot.com




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Learning LISP; Scheme vs elisp.
       [not found] ` <mailman.15710.1217599959.18990.help-gnu-emacs@gnu.org>
@ 2008-08-06 19:38   ` Adam Funk
  0 siblings, 0 replies; 14+ messages in thread
From: Adam Funk @ 2008-08-06 19:38 UTC (permalink / raw)
  To: help-gnu-emacs

On 2008-08-01, Thien-Thi Nguyen wrote:

> warriors attack, felling foe after foe,
> few growing old til they realize: to know
> what deceit is worth deflection;
> such receipt reversed rejection!
> then their heavy arms, e'er transformed to shields:
> balanced hooked charms, ploughed deep, rich yields.

Aha: the exercise for the reader is to place the parens correctly.
Might take me a while to solve this puzzle.


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-08-06 19:38 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-01 12:45 Learning LISP; Scheme vs elisp Adam Funk
2008-08-01 13:06 ` Joost Kremers
2008-08-01 20:26   ` Adam Funk
2008-08-01 14:09 ` Thien-Thi Nguyen
2008-08-01 19:16 ` Joel J. Adamson 
     [not found] ` <mailman.15727.1217618719.18990.help-gnu-emacs@gnu.org>
2008-08-01 20:18   ` David Kastrup
2008-08-04  2:31     ` Joel J. Adamson 
2008-08-01 20:30   ` Adam Funk
2008-08-01 22:10   ` Pascal J. Bourguignon
2008-08-01 21:51 ` Pascal J. Bourguignon
2008-08-02  1:06   ` weber
2008-08-02 12:33 ` Xah
2008-08-02 13:51 ` Xah
     [not found] ` <mailman.15710.1217599959.18990.help-gnu-emacs@gnu.org>
2008-08-06 19:38   ` Adam Funk

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.