Re: Decreasing the "standard deviation" of lisp



Eli Gottlieb <eligottlieb@xxxxxxxxx> writes:

No, I mean actual Common Lisp primitives. You know, like number
support not built from lists of symbols?

Numbers are not built from lists of symbols. They are built from functions:

(defparameter zero (lambda (f) (lambda (x) x)))
(defparameter one (lambda (f) (lambda (x) (funcall f x))))
(defparameter two (lambda (f) (lambda (x) (funcall f (funcall f x)))))
(defparameter three (lambda (f) (lambda (x) (funcall f (funcall f (funcall f x))))))
(defun succ (n) (lambda (f) (lambda (x) (funcall f (funcall (funcall n f) x)))))
(defparameter four (succ three))
(defparameter five (succ four))
;; ...
(defparameter true (lambda (x) (lambda (y) x)))
(defparameter false (lambda (x) (lambda (y) y)))
(defun not (b) (funcall (funcall b false) true))
(defun zerop (n) (funcall (funcall n (lambda (x) false)) true))

(defun add (m)
(lambda (n) (lambda (x) (lambda (y) (funcall (funcall m x) (funcall (funcall n x) y))))))
(defun sub (n) (lambda (m) (funcall (funcall m pred) n)))
(defun mult (n) (lambda (m) (funcall (funcall n (add m)) zero)))
;; etc...

If you mean to use a microprocessor ALU, remember it's only an
optimization, and you can easily implement it writing more lisp code.
Have a look at any Common Lisp compiler (obviously written in Common
Lisp).


apply and eval? let? That stuff must be coded into the
implementation, which is usually (though as you folks so eagerly
repeat, not always) implemented in a lower-level language for
speed/not-having-to-bootstrap purposes.

Not at all. LET is just a macro:

(defmacro let (bindings &body body)
`((lambda ,(mapcar (lambda (item) (if (consp item) (first item) item)))
,@body) ,@(mapcar (lambda (item) (if (cons item) (second item) 'nil)))))

APPLY and EVAL are just lisp functions like any other.

They're not even special operators!


If we could export C functions into Lisp, we could extend
implementations by writing a library.
What makes you think this would be workable (or even a "good thing")
in implementations that don't use C as their main implementation
language, in particular for those which use CL as the main language.
You seem pretty confused about implementation aspects.
/Jon

It's quite simple really: C is the lowest you can go and remain above
assembler code. Thus, if you can interface to C you can interface to
just about anything.

Of course, if you can do the harder thing, you can also do the
easiest. But why would you want to empty the Dead Sea with only a
spoon? Try a toothpick rather. If you can interface to transistors,
you can even interface to more things than with C! You could even go
to the atoms, and interface to the biological world even!!



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

"What is this talk of "release"? Klingons do not make software
"releases". Our software "escapes" leaving a bloody trail of
designers and quality assurance people in its wake."
.



Relevant Pages

  • Re: I wish Id never met Lisp
    ... > into paying me to hack on Lisp. ... > for prime time yet because any Cocoa app built with it apparently ... > .app bundle for your application. ...
    (comp.lang.lisp)
  • Re: 9.2 Networking/Internet
    ... >> This might be a long shot, but is this the only ethernet interface on ... I have a built in NIC but use a wireless so had to ... > There is a wireless card built in as well. ...
    (alt.os.linux.suse)
  • Re: Why Lisp is not popular with average programmers
    ... The reason Lisp is so nice is because it makes software easier to write- and that is pretty much independent of the interface. ... interface-free language as an advantage- less of a pile of stuff to wade through. ... Let's agree that by 'newbie' we mean someone who has programmed in other languages, but is new to Lisp, since the fraction of contemporary newbies whose first language is Lisp is vanishingly small. ... Our newbie is someone who knows that even if he doesn't want to do GUI stuff now, he wants a language with good support for GUI stuff, because he'll likely want to do it later. ...
    (comp.lang.lisp)
  • Re: Features that can only be provided by the implementation?
    ... change "Common Lisp" a lot lately. ... function interface. ... If you go too far in wrapping the platform, ... Here is an example of such a thing: Windows sockets and select. ...
    (comp.lang.lisp)
  • cl-sockets, Google, Lisp-NYC, and The Savages of c.l.l
    ... Lisp-NYC has provided to Google positive evaluations for seven of the nine Summer of Code projects Google sponsored through Lisp NYC. ... libraries go through each implementation's socket library. ... (Foreign Function Interface) ... ForNet is a distributed forensics network. ...
    (comp.lang.lisp)