Re: Decreasing the "standard deviation" of lisp
- From: Pascal Bourguignon <pjb@xxxxxxxxxxxxxxxxx>
- Date: Sat, 29 Apr 2006 08:24:21 +0200
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!
It's quite simple really: C is the lowest you can go and remain aboveIf we could export C functions into Lisp, we could extendWhat makes you think this would be workable (or even a "good thing")
implementations by writing a library.
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
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."
.
- References:
- Decreasing the "standard deviation" of lisp
- From: Ben Prew
- Re: Decreasing the "standard deviation" of lisp
- From: Rainer Joswig
- Re: Decreasing the "standard deviation" of lisp
- From: Cameron MacKinnon
- Re: Decreasing the "standard deviation" of lisp
- From: Pascal Costanza
- Re: Decreasing the "standard deviation" of lisp
- From: Eli Gottlieb
- Re: Decreasing the "standard deviation" of lisp
- From: jayessay
- Re: Decreasing the "standard deviation" of lisp
- From: Eli Gottlieb
- Re: Decreasing the "standard deviation" of lisp
- From: Jack Unrue
- Re: Decreasing the "standard deviation" of lisp
- From: Eli Gottlieb
- Re: Decreasing the "standard deviation" of lisp
- From: jayessay
- Re: Decreasing the "standard deviation" of lisp
- From: Raffael Cavallaro
- Re: Decreasing the "standard deviation" of lisp
- From: Eli Gottlieb
- Re: Decreasing the "standard deviation" of lisp
- From: jayessay
- Re: Decreasing the "standard deviation" of lisp
- From: Eli Gottlieb
- Decreasing the "standard deviation" of lisp
- Prev by Date: Re: which one should I choose?
- Next by Date: Re: How Common Lisp sucks
- Previous by thread: Re: Decreasing the "standard deviation" of lisp
- Next by thread: Re: Decreasing the "standard deviation" of lisp
- Index(es):
Relevant Pages
|