help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs history, and "Is Emacs difficult to learn?"


From: Pascal J. Bourguignon
Subject: Re: Emacs history, and "Is Emacs difficult to learn?"
Date: Thu, 01 Aug 2013 20:40:51 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

Emanuel Berg <embe8573@student.uu.se> writes:

> Note that there is no "C/C++". Those are two different languages,
> with different tools, and with different libraries.

In the same way there's no scheme/emacslisp or emacslisp/common-lisp
languages, but you can still write programs that run on both scheme,
emacs lisp and common lisp!

http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/intersection-r5rs-common-lisp-emacs-lisp/


Oh, and there's no csh/fortran or fortran/c, but you can still run this
program on both sh, csh, fortran and C:

https://groups.google.com/forum/#!msg/comp.lang.lisp/i7CpbNGueXw/jZ5Hhk1iUO4J


But honestly, it's with C and C++ that you can write functions that are
identical and that will compile in both languages into the same
semantics, without adding any compatibility layer.  Even for emacs lisp
vs. common lisp you need at least (require 'cl), and I don't say the
macrology required to run scheme in CL or CL in scheme, just check the
first url above.


[pjb@kuiper :0.0 ~]$ g++ -Werror -Wall -c -o f_c++.o f.c
[pjb@kuiper :0.0 ~]$ gcc -Werror -Wall -c -o f_c.o   f.c
[pjb@kuiper :0.0 ~]$ cat f.c
int f(int x){
    return((0==x)    
           ?1
           :(x*f(x-1)));}
[pjb@kuiper :0.0 ~]$ 

With lisp, you'd have at least to define a macro:

(defmacro define ((fname &rest lambda-list) &body body) 
  `(defun ,fname ,lambda-list ,@body))

to be able to read and run:

(define (f x) (if (= 0 x) 1 (* x (f (- x 1)))))

in both emacs lisp, common lisp and scheme.  Therefore here you could
rightly argue that there's no scheme/common lisp, but two languages.



But not for C/C++, I don't think so.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.  
You know you've been lisping too long when you see a recent picture of George 
Lucas and think "Wait, I thought John McCarthy was dead!" -- Dalek_Baldwin


reply via email to

[Prev in Thread] Current Thread [Next in Thread]