From: P.C.
Subject: Stupid question--
Date: 
Message-ID: <3f2e75c8$0$76145$edfadb0f@dread11.news.tele.dk>
Hi
I alway's wondered how the functions plus and minus is defined in Lisp.
Also / and * btw.
Anyone else wondered ?
P.C.

From: Christophe Rhodes
Subject: Re: Stupid question--
Date: 
Message-ID: <sqwudtqwhc.fsf@lambda.jcn.srcf.net>
"P.C." <··········@privat.dk> writes:

> I alway's wondered how the functions plus and minus is defined in Lisp.
> Also / and * btw.
> Anyone else wondered ?

In one implementation, a bit like this:

(macrolet ((define-arith (op init doc)
             #!-sb-doc (declare (ignore doc))
             `(defun ,op (&rest args)
                #!+sb-doc ,doc
                (if (null args) ,init
                    (do ((args (cdr args) (cdr args))
                         (result (car args) (,op result (car args))))
                        ((null args) result)
                      ;; to signal TYPE-ERROR when exactly 1 arg of wrong type:
                      (declare (type number result)))))))
  (define-arith + 0
    "Return the sum of its arguments. With no args, returns 0."))

(eval-when (:compile-toplevel)

(sb!xc:defmacro two-arg-+/- (name op big-op)
  `(defun ,name (x y)
     (number-dispatch ((x number) (y number))
       (bignum-cross-fixnum ,op ,big-op)
       (float-contagion ,op x y)

       ((complex complex)
        (canonical-complex (,op (realpart x) (realpart y))
                           (,op (imagpart x) (imagpart y))))
       (((foreach bignum fixnum ratio single-float double-float
                  #!+long-float long-float) complex)
        (complex (,op x (realpart y)) (,op (imagpart y))))
       ((complex (or rational float))
        (complex (,op (realpart x) y) (imagpart x)))
       (((foreach fixnum bignum) ratio)
        (let* ((dy (denominator y))
               (n (,op (* x dy) (numerator y))))
          (%make-ratio n dy)))
       ((ratio integer)
        (let* ((dx (denominator x))
               (n (,op (numerator x) (* y dx))))
          (%make-ratio n dx)))
       ((ratio ratio)
        (let* ((nx (numerator x))
               (dx (denominator x))
               (ny (numerator y))
               (dy (denominator y))
               (g1 (gcd dx dy)))
          (if (eql g1 1)
              (%make-ratio (,op (* nx dy) (* dx ny)) (* dx dy))
              (let* ((t1 (,op (* nx (truncate dy g1)) (* (truncate dx g1) ny)))
                     (g2 (gcd t1 g1))
                     (t2 (truncate dx g1)))
                (cond ((eql t1 0) 0)
                      ((eql g2 1)
                       (%make-ratio t1 (* t2 dy)))
                      (T (let* ((nn (truncate t1 g2))
                                (t3 (truncate dy g2))
                                (nd (if (eql t2 1) t3 (* t2 t3))))
                           (if (eql nd 1) nn (%make-ratio nn nd))))))))))))
) ; EVAL-WHEN

(two-arg-+/- two-arg-+ + add-bignums)

Along with a bunch of backend operation's to compile two argument call's
to + with known type's to machine code.

I hope that help's[1].

Christophe

[1] <http://angryflower.com/bobsqu.gif>
-- 
http://www-jcsu.jesus.cam.ac.uk/~csr21/       +44 1223 510 299/+44 7729 383 757
(set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
(defvar b "~&Just another Lisp hacker~%")    (pprint #36rJesusCollegeCambridge)
From: Jeff Massung
Subject: Re: Stupid question--
Date: 
Message-ID: <vit001ruh0bu0a@corp.supernews.com>
Christophe Rhodes <·····@cam.ac.uk> wrote in
···················@lambda.jcn.srcf.net: 

> "P.C." <··········@privat.dk> writes:
> 
>> I alway's wondered how the functions plus and minus is defined in
>> Lisp. Also / and * btw.
>> Anyone else wondered ?
> 
> In one implementation, a bit like this:
> 

[..huge code snipped..]

> Along with a bunch of backend operation's to compile two argument
> call's to + with known type's to machine code.

Please, God, tell me that this all boils down to an ADD instruction when 
finally compiled... perhaps this is where people get the misconception 
that Lisp is slow? :)

-- 
Best regards,
 Jeff                          ··········@mfire.com
                               http://www.simforth.com
From: Erann Gat
Subject: Re: Stupid question--
Date: 
Message-ID: <gat-0408030912290001@k-137-79-50-101.jpl.nasa.gov>
In article <··············@corp.supernews.com>, Jeff Massung
<···@NOSPAM.mfire.com> wrote:

> Christophe Rhodes <·····@cam.ac.uk> wrote in
> ···················@lambda.jcn.srcf.net: 
> 
> > "P.C." <··········@privat.dk> writes:
> > 
> >> I alway's wondered how the functions plus and minus is defined in
> >> Lisp. Also / and * btw.
> >> Anyone else wondered ?
> > 
> > In one implementation, a bit like this:
> > 
> 
> [..huge code snipped..]
> 
> > Along with a bunch of backend operation's to compile two argument
> > call's to + with known type's to machine code.
> 
> Please, God, tell me that this all boils down to an ADD instruction when 
> finally compiled...

It might, if you declared all the numbers involved to be fixnums.  But by
default, Lisp's + provides vastly more functionality than a machine add
instruction.  If you want + to compile to machine add by default then you
ought to be programming in C.

> perhaps this is where people get the misconception 
> that Lisp is slow? :)

This is like comparing an apple to a fully loaded fruit basket and
complaining that the fruit basket is heavier.

E.
From: Jeff Massung
Subject: Re: Stupid question--
Date: 
Message-ID: <vit6i7dne5786a@corp.supernews.com>
···@jpl.nasa.gov (Erann Gat) wrote in
·························@k-137-79-50-101.jpl.nasa.gov: 

> In article <··············@corp.supernews.com>, Jeff Massung
> <···@NOSPAM.mfire.com> wrote:

>> perhaps this is where people get the misconception 
>> that Lisp is slow? :)
> 
> This is like comparing an apple to a fully loaded fruit basket and
> complaining that the fruit basket is heavier.
> 
> E.

I completely agree, but other than inlining compiler optimizations, there 
ought to be a way to get the best performance possible. Of course, perhaps 
a few macros could be coded to do the inlining of optimizations for you.

-- 
Best regards,
 Jeff                          ··········@mfire.com
                               http://www.simforth.com
From: Thomas F. Burdick
Subject: Re: Stupid question--
Date: 
Message-ID: <xcvznip5m7z.fsf@famine.OCF.Berkeley.EDU>
Jeff Massung <···@NOSPAM.mfire.com> writes:

> ···@jpl.nasa.gov (Erann Gat) wrote in
> ·························@k-137-79-50-101.jpl.nasa.gov: 
> 
> > In article <··············@corp.supernews.com>, Jeff Massung
> > <···@NOSPAM.mfire.com> wrote:
> 
> >> perhaps this is where people get the misconception 
> >> that Lisp is slow? :)
> > 
> > This is like comparing an apple to a fully loaded fruit basket and
> > complaining that the fruit basket is heavier.
> 
> I completely agree, but other than inlining compiler optimizations, there 
> ought to be a way to get the best performance possible. Of course, perhaps 
> a few macros could be coded to do the inlining of optimizations for you.

This is up to the implementation.  In CMUCL and SBCL, optimizing
speed=3, and making some key promises to the compiler, generally gets
you very good performance.  The compiler does type inferencing, and
some macros do type arithmetic to insert declarations for you.  If you
do the same thing with your macros, there's hardly any DECLARE or THE
forms in your code.  If you really wanted, you could make a
WITH-IMPOVERISHED-MATH macro inside of which, you'd get C-like math.
It'd be pretty easy.  I think no one else would be interested, though
(but I could be wrong).

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: Christophe Rhodes
Subject: Re: Stupid question--
Date: 
Message-ID: <sqk79tqtn6.fsf@lambda.jcn.srcf.net>
Jeff Massung <···@NOSPAM.mfire.com> writes:

> Christophe Rhodes <·····@cam.ac.uk> wrote in
> ···················@lambda.jcn.srcf.net: 
>
>> "P.C." <··········@privat.dk> writes:
>> 
>>> I alway's wondered how the functions plus and minus is defined in
>>> Lisp. Also / and * btw.
>>> Anyone else wondered ?
>> 
>> In one implementation, a bit like this:
>> 
>
> [..huge code snipped..]
>
> Please, God, tell me that this all boils down to an ADD instruction when 
> finally compiled... perhaps this is where people get the misconception 
> that Lisp is slow? :)

Obviously not in general, and not for the (generic, used in its
generic sense and not in the sense of CLOS functions) definition of
the function +, unless you're on a machine with hardware support for
adding complexes, rationals and floats to each other.  However,
support is there for when you tell the compiler that it must be so:

* (defun foo (x y)
    (declare (optimize speed (safety 0)) (type fixnum x y))
    (the fixnum (+ x y)))

FOO
* (disassemble 'foo)

; 3001DB18:       ADD %A1, %A0                ; no-arg-parsing entry point
; [... snipped four instructions dealing with returning this value ...]

Go not unto Usenet for information, for they will tell you both yay,
and nay, and "Go not unto Usenet...".  In this particular case, asking
your lisp implementation (as I've done, above) would be more
profitable.

Christophe
-- 
http://www-jcsu.jesus.cam.ac.uk/~csr21/       +44 1223 510 299/+44 7729 383 757
(set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
(defvar b "~&Just another Lisp hacker~%")    (pprint #36rJesusCollegeCambridge)
From: Daniel Barlow
Subject: Re: Stupid question--
Date: 
Message-ID: <87u18x9ykg.fsf@noetbook.telent.net>
Jeff Massung <···@NOSPAM.mfire.com> writes:

> Please, God, tell me that this all boils down to an ADD instruction when 
> finally compiled... perhaps this is where people get the misconception 
> that Lisp is slow? :)

I don't see how an ADD instruction would cope with adding two complex
floats and a rational together - or at least, not on what you'd call
"normal" hardware.


-dan

-- 

   http://www.cliki.net/ - Link farm for free CL-on-Unix resources 
From: P.C.
Subject: Re: Stupid question--
Date: 
Message-ID: <3f2ed970$0$76055$edfadb0f@dread11.news.tele.dk>
Hi

"Christophe Rhodes" <·····@cam.ac.uk> skrev i en meddelelse
···················@lambda.jcn.srcf.net...
> "P.C." <··········@privat.dk> writes:
>
> > I alway's wondered how the functions plus and minus is defined in Lisp.
> > Also / and * btw.
> > Anyone else wondered ?
>
> In one implementation, a bit like this:
>
> (macrolet ((define-arith (op init doc)

Snip

>))))))))))))

Snip

Sorry but I can not find any ( Defun +  or (Defun -  oin the example.
Please let me narrow my question to Pure Lisp ; how do you define the function
Plus, that mean the symbol "+"  ?

More specific I am fully capable of reading and writing Lisp programs recursive,
know the magic of Mapcar and I guess it describe my understanding about Lisp, by
the fact that I can add the &rest parameter to AutoLisp that don't carry this
option by placing a recursive function in the paremeter list , -------- now
don't say I am a complete amature when I fully understand recursive and describe
what I want and get just that but -------
How do you program, or how do you Defun the actural "+" function ; how do you
tell how you add 2 and 2 to get 4 ?
Is it simply a primitive that is defined in assembler, and then compiled in C,
and simply impossible to define in Lisp.
I try again ; in Lisp you start with the symbol then what come after the symbol
will replace the symbol when the symbol is evaluated, this is how functions are
"made" in Lisp.
But how to make the symbol "+" add 2 plus 2 and yield 4.
P.C.
From: Matthew Danish
Subject: Re: Stupid question--
Date: 
Message-ID: <20030804223229.GH17568@lain.mapcar.org>
On Tue, Aug 05, 2003 at 12:09:08AM +0200, P.C. wrote:
> Snip
> 
> Sorry but I can not find any ( Defun +  or (Defun -  oin the example.
> Please let me narrow my question to Pure Lisp ; how do you define the
> function Plus, that mean the symbol "+"  ?
>
 [snip]

The implementation of the function + depends upon the representation of
numbers in your system.  Since the representation of numbers is left to
the implementation, the code to implement + is also left to the
implementation.  What Christophe showed you is how SBCL operates on its
representation of numbers.  If you want to write a + function, you need
to know how numbers are represented in your system, or alternatively you
need to define it.  In the SBCL system, most of the number types boil
down to machine-sized data words, and the code to implement arithmetic
is compiled into machine instructions manipulating those words.

For yourself, if you want to play with number representation, one fun
way that will exercise your knowledge of recursive functions is to
implement ``Church numerals''.  There is plenty of reading material on
the WWW for this.

On a side note: the SBCL code makes heavy use of macros and advanced
features of Common Lisp, in addition to SBCL-specific code.  You should
know that a little knowledge of recursive functions and MAPCAR does not
constitute very much knowledge of Common Lisp.

The code which macroexpands into the definition of the function + is
this:

  (define-arith + 0
    "Return the sum of its arguments. With no args, returns 0.")

Learn how macros work, and examine the MACROLET form surrounding this
code, and then you will understand how this works and also why it was
done this way.  And you will be a better programmer for it.

-- 
; Matthew Danish <·······@andrew.cmu.edu>
; OpenPGP public key: C24B6010 on keyring.debian.org
; Signed or encrypted mail welcome.
; "There is no dark side of the moon really; matter of fact, it's all dark."
From: Barry Margolin
Subject: Re: Stupid question--
Date: 
Message-ID: <A%AXa.24$GI6.18@news.level3.com>
In article <·························@dread11.news.tele.dk>,
P.C. <··········@privat.dk> wrote:
>Please let me narrow my question to Pure Lisp ; how do you define the function
>Plus, that mean the symbol "+"  ?
...
>Is it simply a primitive that is defined in assembler, and then compiled in C,
>and simply impossible to define in Lisp.

That's one way to do it.

But I think a more common solution is to open-code it by the compiler, just
as in other languages like C.  So in fact, the source code for + is likely
to look like:

(defun two-argument-+ (x y)
  (+ x y))

(defun + (&optional (x 0) (y 0) &rest more-args)
  (let ((temp (two-argument-+ x y)))
    (if more-args
        (apply #'+ temp more-args)
        temp)))

Although this looks like infinite recursion, it isn't because the compiler
open-codes the first function to do primitive addition.

-- 
Barry Margolin, ··············@level3.com
Level(3), Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Pascal Costanza
Subject: Re: Stupid question--
Date: 
Message-ID: <costanza-85E52D.17345304082003@news.netcologne.de>
In article <·························@dread11.news.tele.dk>,
 "P.C." <··········@privat.dk> wrote:

> Hi
> I alway's wondered how the functions plus and minus is defined in Lisp.
> Also / and * btw.
> Anyone else wondered ?

Taking a look at the HyperSpec is quicker than wondering. ;)

See http://www.lispworks.com/reference/HyperSpec/Body/12_aa.htm for an overview of numeric operations.

Click on the respective links to view the details of each function.


Pascal
From: Joe Marshall
Subject: Re: Stupid question--
Date: 
Message-ID: <8yq8dzew.fsf@ccs.neu.edu>
"P.C." <··········@privat.dk> writes:

> Hi
> I alway's wondered how the functions plus and minus is defined in Lisp.
> Also / and * btw.
> Anyone else wondered ?

At one time I wondered.

On one implementation I worked on, it was defined as follows:

(defun + (a b) (+ a b))

 
From: P.C.
Subject: Re: Stupid question--
Date: 
Message-ID: <3f2fe834$0$76129$edfadb0f@dread11.news.tele.dk>
Hi

"Joe Marshall" <···@ccs.neu.edu> skrev i en meddelelse
·················@ccs.neu.edu...

> (defun + (a b) (+ a b))
>

Now I tried that, but this simply run out of mem and trace isn't much help,
realy I had to ctrl-c to stop trace. I replaced "+" with "+a" just to be sure a
bulid in "+" didn't simply reject a re-defun of a build in function.
Now my question first came inmind, when I read about "Pure Lisp" , where you
with 5 primitive functions ;

Car Cdr Cons Atom and Eq

shuld be able to compose whatever Lisp function,
 (I Danicic "Lisp Programming" Isbn 0-632-01181-5)

Before interduced to Common Lisp as how that is described in this forum, I just
had this small brick size Common Lisp bible ,with the exact decription of each
function, and I thought ; " well with Lisp you kind of speak what you
xpect,  ------ or rather write what you ask, put functions together the way, so
you at the same time produce the function and describ what the result consist
of,  and that's nice.
Now I acturly have the Common Lisp manual, the small light blue brick size one,
but that did not help me to find out how Plus or Minus could be described, with
the original Primitive functions, that only made an accurate of each Common Lisp
function, but learned me quite a lot , even I never got started writing Common
Lisp.
----------- And to be honest , I don't think I will ever learn Common Lisp while
one reson I prefered Lisp, was the simple syntax and no need of compiler
instructions ; you se I am no good frien with any compiler and never expect to
be able to work my way thru Error after error after error after error after
error after error ; ------- I expected to write down what I want and then
compile, but this is simply impossible with the Lisp compilers I tried , and I
simply never expect that the simplest language to learn, will ever get a
compiler that simple people can use even you can evaluate the same expressions
without any trouble.
But back on topic,  --------- no I could not get (defun + (x y)(x y)))
To work,  and this make me wonder about "Pure Lisp", guess this simply can't
compute numbers.
P.C.
http://www.designcommunity.com/scrapbook/2648.html
From: Joe Marshall
Subject: Re: Stupid question--
Date: 
Message-ID: <znioc8dc.fsf@ccs.neu.edu>
"P.C." <··········@privat.dk> writes:

> Hi
>
> "Joe Marshall" <···@ccs.neu.edu> skrev i en meddelelse
> ·················@ccs.neu.edu...
>
>> (defun + (a b) (+ a b))
>>
>
> Now I tried that, but this simply run out of mem and trace isn't much help,
> realy I had to ctrl-c to stop trace. 

The reason that it worked in the system I worked on is that the
compiler had special knowledge about +.

The compiler knows about a number of primitive functions.  When it
compiles a function call that invokes a primitive, it simply inserts
the appropriate machine code to perform the operation.  So in the
example I gave, (defun + (a b) (+ a b)), the + that is being defined
is different from the + that is being used in the definition.

Other Lisp systems do it differently, but the fundamental concept is
the same:  there are a set of primitive functions that are provided ex
nihilo (or at least outside the scope of lisp).
From: Barry Margolin
Subject: Re: Stupid question--
Date: 
Message-ID: <SORXa.21$Mg5.10@news.level3.com>
In article <·························@dread11.news.tele.dk>,
P.C. <··········@privat.dk> wrote:
>Hi
>
>"Joe Marshall" <···@ccs.neu.edu> skrev i en meddelelse
>·················@ccs.neu.edu...
>
>> (defun + (a b) (+ a b))
>>
>
>Now I tried that, but this simply run out of mem and trace isn't much help,
>realy I had to ctrl-c to stop trace.

Did you try compiling it?

-- 
Barry Margolin, ··············@level3.com
Level(3), Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Don Geddis
Subject: Re: Stupid question--
Date: 
Message-ID: <87brv3vbvu.fsf@sidious.geddis.org>
"P.C." <··········@privat.dk> writes:
> Now my question first came inmind, when I read about "Pure Lisp" , where you
> with 5 primitive functions ;
> Car Cdr Cons Atom and Eq
> shuld be able to compose whatever Lisp function,
>  (I Danicic "Lisp Programming" Isbn 0-632-01181-5)

That's probably true, in theory, but it doesn't mean that it's easy to do.
It only means that it's possible, for a sufficiently smart programmer.

Hint: you need to decide how to represent numbers at all, using only those
primitive functions, well before you worry about things like adding them
together.  What does the number "3" actually look like?  Start with that
question.

> But back on topic,  --------- no I could not get (defun + (x y)(x y)))
> To work,  and this make me wonder about "Pure Lisp", guess this simply can't
> compute numbers.

Let's see...because you, a novice, was unable to figure out how to do it after
a tiny effort, you therefore conclude that it's impossible to "compute
numbers" at all (using "pure lisp")?

Perhaps a more clever/experienced programmer could succeed, where you failed...

_______________________________________________________________________________
Don Geddis                  http://don.geddis.org/               ···@geddis.org
I am not sure what this is, but an `F' would only dignify it.
	-- Unknown English Professor
From: Rob Warnock
Subject: Re: Stupid question--
Date: 
Message-ID: <hK-cnVlO-97vfamiXTWc-g@speakeasy.net>
Don Geddis  <···@geddis.org> wrote:
+---------------
| "P.C." <··········@privat.dk> writes:
| > Now my question first came inmind, when I read about "Pure Lisp",
| > where you with 5 primitive functions ;
| > Car Cdr Cons Atom and Eq
| > shuld be able to compose whatever Lisp function,
...
| Hint: you need to decide how to represent numbers at all, using only those
| primitive functions, well before you worry about things like adding them
| together.  What does the number "3" actually look like?  Start with that
| question.
+---------------

For the serious student, this paper is an excellent introduction to the
topic, including a survey of what various implementations have used and
a comparison of execution-time costs of each approach:

  <URL:ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/pubs/typeinfo.ps.gz>
  Gudeman: "Representing Type Information in Dynamically Typed Languages"


-Rob

-----
Rob Warnock, PP-ASEL-IA		<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: P.C.
Subject: Re: Stupid question--
Date: 
Message-ID: <3f354810$0$76095$edfadb0f@dread11.news.tele.dk>
Hi

"Rob Warnock" <····@rpw3.org> skrev i en meddelelse
···························@speakeasy.net...
> Don Geddis  <···@geddis.org> wrote:
> For the serious student, this paper is an excellent introduction to the
> topic, including a survey of what various implementations have used and
> a comparison of execution-time costs of each approach:
>
>   <URL:ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/pubs/typeinfo.ps.gz>
>   Gudeman: "Representing Type Information in Dynamically Typed Languages"

Eh, --------- when I enter that Gz file, my very very old VRLM viewer that I
thought was replaced with a better one years ago, open and reward with an error.
Gz is some compressef format I guess, --------- anyway I realy don't want to put
a minus before the file name, to go around the repeated "error" messeage that
obviously would keep me from seing these comperssed files.
P.C.
From: Pascal Costanza
Subject: Re: Stupid question--
Date: 
Message-ID: <costanza-6466FA.21205409082003@news.netcologne.de>
In article <·························@dread11.news.tele.dk>,
 "P.C." <··········@privat.dk> wrote:

> Hi
> 
> "Rob Warnock" <····@rpw3.org> skrev i en meddelelse
> ···························@speakeasy.net...
> > Don Geddis  <···@geddis.org> wrote:
> > For the serious student, this paper is an excellent introduction to the
> > topic, including a survey of what various implementations have used and
> > a comparison of execution-time costs of each approach:
> >
> >   <URL:ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/pubs/typeinfo.ps.g
> >   z>
> >   Gudeman: "Representing Type Information in Dynamically Typed Languages"
> 
> Eh, --------- when I enter that Gz file, my very very old VRLM viewer that I
> thought was replaced with a better one years ago, open and reward with an 
> error.
> Gz is some compressef format I guess, --------- anyway I realy don't want to 
> put
> a minus before the file name, to go around the repeated "error" messeage that
> obviously would keep me from seing these comperssed files.


Try to open the file with WinZIP on Windows, gunzip on Unix/Linux or 
Stuffit Expander on Mac.


Pascal
From: P.C.
Subject: Re: Stupid question--
Date: 
Message-ID: <3f3559fb$0$76160$edfadb0f@dread11.news.tele.dk>
Hi

"Pascal Costanza" <········@web.de> skrev i en meddelelse
···································@news.netcologne.de...
> In article <·························@dread11.news.tele.dk>,
>  "P.C." <··········@privat.dk> wrote:

> Try to open the file with WinZIP on Windows, gunzip on Unix/Linux or
> Stuffit Expander on Mac.
>
>
> Pascal

Tried saving the file and renaming it to a zip file ; wierd things happened,
first winzip disapear , then the unzipped file is not there, then the downloaded
renamed file are gone , -------- into some Sceme parentets I guess ;))

P.C.
From: Don Geddis
Subject: Re: Stupid question--
Date: 
Message-ID: <87llu2mhs6.fsf@sidious.geddis.org>
> "Pascal Costanza" <········@web.de> wrote:
> > Try to open the file with WinZIP on Windows, gunzip on Unix/Linux or
> > Stuffit Expander on Mac.

"P.C." <··········@privat.dk> writes:
> Tried saving the file and renaming it to a zip file ; wierd things
> happened, first winzip disapear , then the unzipped file is not there,
> then the downloaded renamed file are gone , -------- into some Sceme
> parentets I guess ;))

Why did you rename it?  Nobody told you to do that.  It isn't a ZIP file
(which the .zip extention would claim), it's a GZip file (hence .gz).
That's totally different.  Of course the programs are confused if you rename
the file such that you mislead the programs about the file type.

Try again, using the original name.

        -- Don
_______________________________________________________________________________
Don Geddis                  http://don.geddis.org/               ···@geddis.org
From: Pascal Costanza
Subject: Re: Stupid question--
Date: 
Message-ID: <costanza-1DECF6.00462310082003@news.netcologne.de>
In article <·························@dread11.news.tele.dk>,
 "P.C." <··········@privat.dk> wrote:

> Hi
> 
> "Pascal Costanza" <········@web.de> skrev i en meddelelse
> ···································@news.netcologne.de...
> > In article <·························@dread11.news.tele.dk>,
> >  "P.C." <··········@privat.dk> wrote:
> 
> > Try to open the file with WinZIP on Windows, gunzip on Unix/Linux or
> > Stuffit Expander on Mac.
> >
> >
> > Pascal
> 
> Tried saving the file and renaming it to a zip file ; wierd things happened,
> first winzip disapear , then the unzipped file is not there, then the 
> downloaded
> renamed file are gone , -------- into some Sceme parentets I guess ;))

Well, I didn't say that you should rename the file, did I?


Pascal
From: Thomas F. Burdick
Subject: Re: Stupid question--
Date: 
Message-ID: <xcvu18v454p.fsf@famine.OCF.Berkeley.EDU>
"P.C." <··········@privat.dk> writes:

> Hi
> 
> "Joe Marshall" <···@ccs.neu.edu> skrev i en meddelelse
> ·················@ccs.neu.edu...
> 
> > (defun + (a b) (+ a b))
> >
> 
> Now I tried that, but this simply run out of mem and trace isn't much help,
> realy I had to ctrl-c to stop trace. I replaced "+" with "+a" just to be sure a
> bulid in "+" didn't simply reject a re-defun of a build in function.
> Now my question first came inmind, when I read about "Pure Lisp" , where you
> with 5 primitive functions ;
> 
> Car Cdr Cons Atom and Eq
> 
> shuld be able to compose whatever Lisp function,
>  (I Danicic "Lisp Programming" Isbn 0-632-01181-5)

This isn't how things are done.  However, things *can* be done this
way, if you don't ming a polynomial increase in complexity.  Check out
this post:
<http://groups.google.com/groups?selm=sfwk7bs3gfb.fsf%40shell01.TheWorld.com>

Then learn about Church Numerals.  None of this is practical, in a
solving-a-real-problem kind of way, but it should definately streach
your mind, which is quite useful in its own right.

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: Joe Marshall
Subject: Re: Stupid question--
Date: 
Message-ID: <znim51n0.fsf@ccs.neu.edu>
···@famine.OCF.Berkeley.EDU (Thomas F. Burdick) writes:

> "P.C." <··········@privat.dk> writes:
>
>> Now my question first came inmind, when I read about "Pure Lisp" , where you
>> with 5 primitive functions ;
>> 
>> Car Cdr Cons Atom and Eq
>> 
>> shuld be able to compose whatever Lisp function,
>>  (I Danicic "Lisp Programming" Isbn 0-632-01181-5)
>
> This isn't how things are done.  However, things *can* be done this
> way, if you don't ming a polynomial increase in complexity.  Check out
> this post:
> <http://groups.google.com/groups?selm=sfwk7bs3gfb.fsf%40shell01.TheWorld.com>
>
> Then learn about Church Numerals.  None of this is practical, in a
> solving-a-real-problem kind of way, but it should definately streach
> your mind, which is quite useful in its own right.

But how do you interface to an ODBC driver with Church Numerals?
From: mikel
Subject: Re: Stupid question--
Date: 
Message-ID: <060820030851370170%mikel@evins.net>
In article <············@ccs.neu.edu>, Joe Marshall <···@ccs.neu.edu>
wrote:

> ···@famine.OCF.Berkeley.EDU (Thomas F. Burdick) writes:
> 
> > "P.C." <··········@privat.dk> writes:
> >
> >> Now my question first came inmind, when I read about "Pure Lisp" , where
> >> you
> >> with 5 primitive functions ;
> >> 
> >> Car Cdr Cons Atom and Eq
> >> 
> >> shuld be able to compose whatever Lisp function,
> >>  (I Danicic "Lisp Programming" Isbn 0-632-01181-5)
> >
> > This isn't how things are done.  However, things *can* be done this
> > way, if you don't ming a polynomial increase in complexity.  Check out
> > this post:
> >
> > <http://groups.google.com/groups?selm=sfwk7bs3gfb.fsf%40shell01.TheWorld.com>
> > 
> >
> > Then learn about Church Numerals.  None of this is practical, in a
> > solving-a-real-problem kind of way, but it should definately streach
> > your mind, which is quite useful in its own right.
> 
> But how do you interface to an ODBC driver with Church Numerals?


Slowly.
From: Thomas F. Burdick
Subject: Re: Stupid question--
Date: 
Message-ID: <xcvptji4t03.fsf@famine.OCF.Berkeley.EDU>
Joe Marshall <···@ccs.neu.edu> writes:

> ···@famine.OCF.Berkeley.EDU (Thomas F. Burdick) writes:
> 
> > "P.C." <··········@privat.dk> writes:
> >
> >> Now my question first came inmind, when I read about "Pure Lisp" , where you
> >> with 5 primitive functions ;
> >> 
> >> Car Cdr Cons Atom and Eq
> >> 
> >> shuld be able to compose whatever Lisp function,
> >>  (I Danicic "Lisp Programming" Isbn 0-632-01181-5)
> >
> > This isn't how things are done.  However, things *can* be done this
> > way, if you don't ming a polynomial increase in complexity.  Check out
> > this post:
> > <http://groups.google.com/groups?selm=sfwk7bs3gfb.fsf%40shell01.TheWorld.com>
> >
> > Then learn about Church Numerals.  None of this is practical, in a
> > solving-a-real-problem kind of way, but it should definately streach
> > your mind, which is quite useful in its own right.
> 
> But how do you interface to an ODBC driver with Church Numerals?

By adding PEEK and POKE to your set of primitives?

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: pkhuong
Subject: Re: Stupid question--
Date: 
Message-ID: <51184814.0308060937.4ed2418e@posting.google.com>
Joe Marshall <···@ccs.neu.edu> wrote in message news:<············@ccs.neu.edu>...
> ···@famine.OCF.Berkeley.EDU (Thomas F. Burdick) writes:
> 
> > "P.C." <··········@privat.dk> writes:
> >
> >> Now my question first came inmind, when I read about "Pure Lisp" , where you
> >> with 5 primitive functions ;
> >> 
> >> Car Cdr Cons Atom and Eq
> >> 
> >> shuld be able to compose whatever Lisp function,
[...]
> > Then learn about Church Numerals.  None of this is practical, in a
> > solving-a-real-problem kind of way, but it should definately streach
> > your mind, which is quite useful in its own right.
> 
> But how do you interface to an ODBC driver with Church Numerals?

The OP asked about implementing arithmetic in a pure Lisp context, not
in a real world one. This is all, of course, theoretical. If one wants
to do arithmetic without relying on underlying hardware, one must
define numbers in an equally hardware independant way.

Note, you COULD define boolean operators in pure lisp, and then build
arithmetic like is used in real hardware on top of that, no?
From: P.C.
Subject: Re: Stupid question--
Date: 
Message-ID: <3f3213c5$0$76048$edfadb0f@dread11.news.tele.dk>
Hi

"pkhuong" <··········@pvk.ca> skrev i en meddelelse
·································@posting.google.com...
> Joe Marshall <···@ccs.neu.edu> wrote in message
news:<············@ccs.neu.edu>...
> > ···@famine.OCF.Berkeley.EDU (Thomas F. Burdick) writes:

> Note, you COULD define boolean operators in pure lisp, and then build
> arithmetic like is used in real hardware on top of that, no?

Thought about that.
P.C.