Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Carteisan, cross, outer products (was Re: My opinion re LISP)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 76 - 100 of 109 - Collapse all  -  Translate all to Translated (View all originals) < Older  Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
William Deakin  
View profile  
 More options Oct 24 2000, 3:00 am
Newsgroups: comp.lang.lisp
From: William Deakin <w.dea...@pindar.com>
Date: 2000/10/24
Subject: Re: Carteisan, cross, outer products (was Re: My opinion re LISP)
Tim wrote:
> If you mean classical electrodynamics then I think that doing it
> without diff.geom is insane (though often done).

Futile and frustrating perhaps, insane I'm not so sure?! You can work
out Thompson's correction to 473 significant figures with a bit of hand
waving and the correctly applied Lorentz-Fitzgerald contraction

> Sure it's `easier' but this is in the same way that Windows is
> easier than Unix: it's faster to learn,
...true...
> but eventually you just get so frustrated you have to take an
> angle-grinder to the computer, and it really takes ages to get
> all the little bits of computer out of the carpet.

Even more true, although I prefer a hammer -- depending either a large
woodworking mallet or a 2LB lump-hammer -- as you don't have to plug it
in. [1]

> QED on the other hand is fully boggle-enabled with or without
> diff.geom.

Time to get my boggle googles,

;)will

[1] For a fine selection, buy on line:
www.engineeringsupplies.com/acatalog/Online_Catalogue_Hammers___Malle...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "My opinion re LISP" by Christian Lynbech
Christian Lynbech  
View profile  
 More options Oct 25 2000, 3:00 am
Newsgroups: comp.lang.lisp
From: Christian Lynbech <c...@ericssontelebit.com>
Date: 2000/10/25
Subject: Re: My opinion re LISP

>>>>> "Tim" == Tim Bradshaw <t...@cley.com> writes:

Tim> * Claire Quilty wrote:

>> I am NOT wrong. I am right, and YOU are wrong.

Tim> I wish to put this article forward for consideration as c.l.l posting
Tim> of the year.

I second that.

Would this not be something for the Association of Lisp Users? They
could ask for nominations in January, have a committe choose the most
deserving entry, and then they could post the result on the website.

---------------------------+----------------------------------------------- ---
Christian Lynbech          | Ericsson Telebit, Fabrikvej 11, DK-8260 Viby J  
Fax:   +45 8675 6881       | email: c...@ericssontelebit.com
Phone: +45 8675 6828       | web:   www.ericssontelebit.com
---------------------------+----------------------------------------------- ---
Hit the philistines three times over the head with the Elisp reference manual.
                                        - peto...@hal.com (Michael A. Petonic)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ThaneOfFife  
View profile  
 More options Oct 25 2000, 3:00 am
Newsgroups: comp.lang.lisp
From: ThaneOfFife <cr...@my-deja.com>
Date: 2000/10/25
Subject: Re: My opinion re LISP
In article <ofwvexi6yt....@chl.ted.dk.eu.ericsson.se>,
  Christian Lynbech <c...@ericssontelebit.com> wrote:

> >>>>> "Tim" == Tim Bradshaw <t...@cley.com> writes:

> Tim> * Claire Quilty wrote:
> >> I am NOT wrong. I am right, and YOU are wrong.

> Tim> I wish to put this article forward for consideration as c.l.l
posting
> Tim> of the year.

> I second that.

> Would this not be something for the Association of Lisp Users? They
> could ask for nominations in January, have a committe choose the most
> deserving entry, and then they could post the result on the website.

Be sure to include the actual quote in dispute so that anyone with any
knowledge of the matter can see that I am right. :-)

BTW, my Programming Languages class had to turn in that LISP lab today,
but at the end of class the prof walked out with the completed lab
assignment of only of the more thatn 20 students. Everyone else was
scrambling to grok enough LISP to complete the assignment. Guess which
student was able to complete the assignment. That's right, me, Claire
Quilty....

Sent via Deja.com http://www.deja.com/
Before you buy.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ThaneOfFife  
View profile  
 More options Oct 25 2000, 10:00 pm
Newsgroups: comp.lang.lisp
From: ThaneOfFife <cr...@my-deja.com>
Date: Thu, 26 Oct 2000 01:48:37 GMT
Local: Wed, Oct 25 2000 9:48 pm
Subject: Re: My opinion re LISP
In article <8ssjpi$9a...@snoopy.online.no>,
  Arne Knut Roev <akr...@online.no> wrote:

So by your logic, LISP is superior because (for whatever reason) there
are fewer ads for it than C++ or Java? So therefore, by your logic, if
LISP had even FEWER ads, it would be even MORE superior. How about some
toy language that I may invent -- call it Quilty++ -- which of course
has zero responses in the job search engines. I suppose, by your logic
this means Quilty++ is very much superior not only to Java and C++, but
also to LISP (never mind that all programs in Quilty++ must consist of
one and only one statement: x = y ).
That shure is some fancy logic ya got there, fella...

Ever faithfully,
Your boon and bosom companion,
Claire Quilty

Sent via Deja.com http://www.deja.com/
Before you buy.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bruce Hoult  
View profile  
 More options Oct 25 2000, 10:22 pm
Newsgroups: comp.lang.lisp
From: Bruce Hoult <br...@hoult.org>
Date: Thu, 26 Oct 2000 15:22:57 +1300
Local: Wed, Oct 25 2000 10:22 pm
Subject: Re: My opinion re LISP
In article <8t7nam$5m...@nnrp1.deja.com>, ThaneOfFife

<cr...@my-deja.com> wrote:
> BTW, my Programming Languages class had to turn in that LISP lab today,
> but at the end of class the prof walked out with the completed lab
> assignment of only of the more thatn 20 students. Everyone else was
> scrambling to grok enough LISP to complete the assignment. Guess which
> student was able to complete the assignment. That's right, me, Claire
> Quilty....

How about showing your code here?

-- Bruce


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Naggum  
View profile  
 More options Oct 26 2000, 1:33 am
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.net>
Date: 26 Oct 2000 03:52:21 +0000
Local: Wed, Oct 25 2000 11:52 pm
Subject: Re: My opinion re LISP
* ThaneOfFife <cr...@my-deja.com>
| BTW, my Programming Languages class had to turn in that LISP lab
| today, but at the end of class the prof walked out with the
| completed lab assignment of only of the more thatn 20 students.
| Everyone else was scrambling to grok enough LISP to complete the
| assignment.  Guess which student was able to complete the
| assignment.  That's right, me, Claire Quilty....p

  Does it really make you feel any better to have to post such obvious
  self-flattery that nobody can verify?  You are truly pathetic the
  way you have to post something so transparently intended to recover
  some of your lost credibility in your _own_ mind.

#:Erik
--
  I agree with everything you say, but I would
  attack to death your right to say it.
                                -- Tom Stoppard


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Naggum  
View profile  
 More options Oct 26 2000, 1:33 am
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.net>
Date: 26 Oct 2000 03:47:00 +0000
Subject: Re: My opinion re LISP
* ThaneOfFife <cr...@my-deja.com>
| That shure is some fancy logic ya got there, fella...

  It looks like you produced the insanity you insist on stuffing into
  somebody else's mouth.  Try and grow up so you can accept full
  responsibility for your own lack of ability to think clearly.

  Here's a clue for you: We're not talking about languages you invent.
  Here's another clue for you: Bad craftsmanship begets higher demand
  for (bad) craftsmen.  And yet another clue: If it is so hard to
  become good at a language that nobody really does, the people who
  get hired and fired shortly thereafter will be alarmingly higher
  than for a language that it is possible to learn really well,
  because the people who do are not in as high circulation.

  Go back to hacking some Perl and C++, now, "fella".  Those languages
  are more suitable to people of your intellectual prowess than you
  will understand, or admit if you do.

#:Erik
--
  I agree with everything you say, but I would
  attack to death your right to say it.
                                -- Tom Stoppard


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
William Deakin  
View profile  
 More options Oct 26 2000, 7:27 am
Newsgroups: comp.lang.lisp
From: William Deakin <w.dea...@pindar.com>
Date: Thu, 26 Oct 2000 12:29:03 +0100
Local: Thurs, Oct 26 2000 7:29 am
Subject: Re: My opinion re LISP

Bruce Hoult wrote:
> How about showing your code here?

How about *not* showing your code here...

Will


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
vsync  
View profile  
 More options Oct 26 2000, 3:32 pm
Newsgroups: comp.lang.lisp
From: vsync <vs...@quadium.net>
Date: Thu, 26 Oct 2000 19:32:38 GMT
Local: Thurs, Oct 26 2000 3:32 pm
Subject: Re: My opinion re LISP

ThaneOfFife <cr...@my-deja.com> writes:
> So by your logic, LISP is superior because (for whatever reason) there
> are fewer ads for it than C++ or Java? So therefore, by your logic, if
> LISP had even FEWER ads, it would be even MORE superior. How about some

I was being sarcastic, mainly.  Thing is, I tend to distrust
commercial sponsorship, especially when it leads to hyperactive
marketing.  Take Java, for example.  It has taken hold in a market it
was unintended for (and I think mostly unsuited for) first due to
"industry analysts" who declared it "dead on the client", the area it
_was_ suited for, and then by marketing people who made a big deal
about Java on the server, an area for which it is decidedly not
optimal.

--
vsync
http://quadium.net/ - last updated Sat Oct 7 18:53:10 PDT 2000
(cons (cons (car (cons 'c 'r)) (cdr (cons 'a 'o))) ; Orjner
      (cons (cons (car (cons 'n 'c)) (cdr (cons nil 's))) nil))


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
vsync  
View profile  
 More options Oct 26 2000, 3:34 pm
Newsgroups: comp.lang.lisp
From: vsync <vs...@quadium.net>
Date: Thu, 26 Oct 2000 19:34:00 GMT
Subject: Re: My opinion re LISP

ThaneOfFife <cr...@my-deja.com> writes:
> BTW, my Programming Languages class had to turn in that LISP lab today,
> but at the end of class the prof walked out with the completed lab
> assignment of only of the more thatn 20 students. Everyone else was
> scrambling to grok enough LISP to complete the assignment. Guess which
> student was able to complete the assignment. That's right, me, Claire
> Quilty....

So has your opinion of Lisp changed at all?  Or are you planning to
give it more of a chance?  It's my experience that the thrill of
initial success in a challenging subject is incredibly addictive...

--
vsync
http://quadium.net/ - last updated Sat Oct 7 18:53:10 PDT 2000
(cons (cons (car (cons 'c 'r)) (cdr (cons 'a 'o))) ; Orjner
      (cons (cons (car (cons 'n 'c)) (cdr (cons nil 's))) nil))


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Arne Knut Roev  
View profile  
 More options Oct 26 2000, 7:15 pm
Newsgroups: comp.lang.lisp
From: Arne Knut Roev <akr...@online.no>
Date: 26 Oct 2000 17:59:37 GMT
Local: Thurs, Oct 26 2000 1:59 pm
Subject: Re: My opinion re LISP

No.

And since I am in a good mood tonight, I'll use this opportunity to
exercise my teaspoon-mode:

When you see such statistics, there are _several_ possible explanations
for their pattern:

   1. It could be that programmers of LISP are so efficient that the
      market only needs a very small number of them.

   2. It could be that programmers of other languages are so retarded
      as to create a mass demand for new programmers to sort out their
      messes and salvage whatever useful things there might be left in
      their projects after the crap has been filtered out.

   3. It could be that most companies that are searching for LISP
      programmers, have discovered that advertising for them doesn't work.

   4. It could be that LISP programmers have the ability to find good
      employers that are then able to keep them on for a _long_ time.

   5. It could be that the management of most companies out there are
      unaware of what the good tools are, and unwilling to listen to
      advice on this from people who know what they are talking about.

   6. It could be a combination of the above factors, and I won't rule
      out that there could be additional factors deciding this.

So, my remark was simply a tongue-in-cheek remark that there could be
several explanations for that kind of slant in ad numbers, and that
consequently, the numbers themselves could not be taken to either prove
or disprove (or even indicate) any theory on their meaning.

--
Arne Knut Roev <akr...@online.no> Snail: N-6141 ROVDE, Norway
=
The Gates of Hell shall not prevail:
Darkness now; then Light!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeff Roberts  
View profile  
 More options Oct 26 2000, 9:01 pm
Newsgroups: comp.lang.lisp
From: "Jeff Roberts" <Jeffreyrobe...@sympatico.ca>
Date: Fri, 27 Oct 2000 01:00:16 GMT
Local: Thurs, Oct 26 2000 9:00 pm
Subject: Re: My opinion re LISP
 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Espen Vestre  
View profile  
 More options Oct 27 2000, 7:38 am
Newsgroups: comp.lang.lisp
From: Espen Vestre <espen@*do-not-spam-me*.vestre.net>
Date: 27 Oct 2000 13:37:59 +0200
Local: Fri, Oct 27 2000 7:37 am
Subject: Re: My opinion re LISP

vsync <vs...@quadium.net> writes:
> about Java on the server, an area for which it is decidedly not optimal.

but it sure sells a lot of Sun hardware ;-)
--
  (espen)

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marco Antoniotti  
View profile  
 More options Nov 1 2000, 9:38 am
Newsgroups: comp.lang.lisp
From: Marco Antoniotti <marc...@cs.nyu.edu>
Date: 01 Nov 2000 09:34:17 -0500
Local: Wed, Nov 1 2000 9:34 am
Subject: Re: My opinion re LISP

Gimme a break! :)

        (defun sum (&optional (lower 0) (upper lower))
          (loop for n from lower upto upper sum n))
* (sum)
0
* (sum 0 1)
1
* (sum 1 0)
0
* (sum 1 4)
10
*

Cheers

--
Marco Antoniotti =============================================================
NYU Bioinformatics Group                         tel. +1 - 212 - 998 3488
719 Broadway 12th Floor                          fax  +1 - 212 - 995 4122
New York, NY 10003, USA                          http://galt.mrl.nyu.edu/valis
             Like DNA, such a language [Lisp] does not go out of style.
                              Paul Graham, ANSI Common Lisp


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marco Antoniotti  
View profile  
 More options Nov 1 2000, 9:40 am
Newsgroups: comp.lang.lisp
From: Marco Antoniotti <marc...@cs.nyu.edu>
Date: 01 Nov 2000 09:36:07 -0500
Local: Wed, Nov 1 2000 9:36 am
Subject: Re: My opinion re LISP

        (reduce #'+ (iota 10))

Cheers

--
Marco Antoniotti =============================================================
NYU Bioinformatics Group                         tel. +1 - 212 - 998 3488
719 Broadway 12th Floor                          fax  +1 - 212 - 995 4122
New York, NY 10003, USA                          http://galt.mrl.nyu.edu/valis
             Like DNA, such a language [Lisp] does not go out of style.
                              Paul Graham, ANSI Common Lisp


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gareth McCaughan  
View profile  
 More options Nov 1 2000, 7:44 pm
Newsgroups: comp.lang.lisp
From: Gareth.McCaug...@pobox.com (Gareth McCaughan)
Date: Wed, 1 Nov 2000 21:40:49 +0000
Local: Wed, Nov 1 2000 4:40 pm
Subject: Re: My opinion re LISP

Marco Antoniotti wrote:

[Friedrich Dominicus:]

> > Haskell:
> >         sum [1 .. 10]

..
> Gimme a break! :)

>    (defun sum (&optional (lower 0) (upper lower))
>           (loop for n from lower upto upper sum n))

Not entirely fair, I think. More like

    (defun sum (list) (reduce #'+ list))
    (defun range (lower upper)
      (loop for n from lower upto upper collect n))

except that Haskell is lazy so it's really more like
using SERIES.

(The point is that the snippet of Haskell above is
displaying two useful and concisely-expressed abstractions,
not a single, rather useless, sum-of-arithmetic-progression
function.)

--
Gareth McCaughan  Gareth.McCaug...@pobox.com
sig under construc


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Monfera  
View profile  
 More options Nov 1 2000, 9:22 pm
Newsgroups: comp.lang.lisp
From: Robert Monfera <monf...@fisec.com>
Date: Thu, 02 Nov 2000 02:22:07 GMT
Local: Wed, Nov 1 2000 9:22 pm
Subject: Re: My opinion re LISP

Marco Antoniotti wrote:
> Gimme a break! :)

>         (defun sum (&optional (lower 0) (upper lower))
>           (loop for n from lower upto upper sum n))

Do you guys really need a loop for summing a series of integers?!?

I can tell you without switching to my lisp listener that
 sum[1..100] = (1 + 100) + (2 + 99) + ... + ( 50 + 51) =
             = (1 + 100) * 50
             = 5050

Homework #1: name the matemathician who was asked by a teacher to sum
all integers  between 1 and 100 in the hope that he is going to sit
tight for a good while (no HP calculators that time).

Homework #2: generalize the above algorithm and write a CL function that
sums [n .. m] in O(1) time.

And nobody dare to help Marco!

Robert


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Monfera  
View profile  
 More options Nov 1 2000, 9:28 pm
Newsgroups: comp.lang.lisp
From: Robert Monfera <monf...@fisec.com>
Date: Thu, 02 Nov 2000 02:28:09 GMT
Local: Wed, Nov 1 2000 9:28 pm
Subject: Re: My opinion re LISP

Gareth McCaughan wrote:
> > > Haskell:
> > >         sum [1 .. 10]
>     (defun sum (list) (reduce #'+ list))
>     (defun range (lower upper)
>       (loop for n from lower upto upper collect n))

> except that Haskell is lazy so it's really more like
> using SERIES.

> (The point is that the snippet of Haskell above is
> displaying two useful and concisely-expressed abstractions,
> not a single, rather useless, sum-of-arithmetic-progression
> function.)

Series will translate the two functions into one loop (two loops and
lots of consing if you use generic functions or use optional
arguments).  Would not haskell be smarter?  Is there a pure, lazy
functional language environment which has a decent disassemble?

Robert


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Friedrich Dominicus  
View profile  
 More options Nov 2 2000, 1:21 am
Newsgroups: comp.lang.lisp
From: Friedrich Dominicus <fr...@q-software-solutions.com>
Date: 02 Nov 2000 07:59:18 +0100
Local: Thurs, Nov 2 2000 1:59 am
Subject: Re: My opinion re LISP

Robert Monfera <monf...@fisec.com> writes:

> Do you guys really need a loop for summing a series of integers?!?

Yes, yes, yes. Because the third most important programm (you know the
two other, don't you, the factorial is as important. With my limited
mental capacity I can write

sum [1 .. 10] -> whatever ;-)
AND
product [1..10] -> factorial ;-)

So I just have to remember switching from sum to product. That suits
me ;-)))

Regards
Friedrich
--
for e-mail reply remove all after .com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marco Antoniotti  
View profile  
 More options Nov 2 2000, 9:37 am
Newsgroups: comp.lang.lisp
From: Marco Antoniotti <marc...@cs.nyu.edu>
Date: 02 Nov 2000 09:33:10 -0500
Local: Thurs, Nov 2 2000 9:33 am
Subject: Re: My opinion re LISP

You know I HATE these problems.  My mind is already spinning. <:{

Cheers

--
Marco Antoniotti =============================================================
NYU Bioinformatics Group                         tel. +1 - 212 - 998 3488
719 Broadway 12th Floor                          fax  +1 - 212 - 995 4122
New York, NY 10003, USA                          http://galt.mrl.nyu.edu/valis
             Like DNA, such a language [Lisp] does not go out of style.
                              Paul Graham, ANSI Common Lisp


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jon S Anthony  
View profile  
 More options Nov 2 2000, 7:12 pm
Newsgroups: comp.lang.lisp
From: Jon S Anthony <j...@synquiry.com>
Date: Thu, 02 Nov 2000 19:08:49 -0500
Local: Thurs, Nov 2 2000 7:08 pm
Subject: Re: My opinion re LISP

Gauss

> Homework #2: generalize the above algorithm and write a CL function that
> sums [n .. m] in O(1) time.

= m(m+1)/2 - n(n-1)/2

/Jon

--
Jon Anthony
Synquiry Technologies, Ltd. Belmont, MA 02478, 617.484.3383
"Nightmares - Ha!  The way my life's been going lately,
 Who'd notice?"  -- Londo Mollari


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David A Vincent  
View profile  
 More options Nov 2 2000, 7:25 pm
Newsgroups: comp.lang.lisp
From: David A Vincent <dav...@hsa.com.au>
Date: 03 Nov 2000 11:22:46 +1100
Local: Thurs, Nov 2 2000 7:22 pm
Subject: Re: My opinion re LISP

Robert Monfera <monf...@fisec.com> writes:
> Marco Antoniotti wrote:

[...]

> Do you guys really need a loop for summing a series of integers?!?

[...]

> Homework #1: name the matemathician who was asked by a teacher to sum
> all integers  between 1 and 100 in the hope that he is going to sit
> tight for a good while (no HP calculators that time).

[...]

Perhaps you mean the mathematician Gauss (as a child), of whom this
story is sometimes told.  

Sadly there seems to be little historical basis for the story.

D

--
David A Vincent                              <mailto:dav...@hsa.com.au>
Analyst/Programmer                          HSA net <http://1.0.0.246/>
Hydrographic Sciences Australia          HSA Sydney phone extension #28
                Strunk and White: "Omit needless words"


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gareth McCaughan  
View profile  
 More options Nov 2 2000, 8:25 pm
Newsgroups: comp.lang.lisp
From: Gareth.McCaug...@pobox.com (Gareth McCaughan)
Date: Fri, 3 Nov 2000 01:20:21 +0000
Local: Thurs, Nov 2 2000 8:20 pm
Subject: Re: My opinion re LISP

Robert Monfera wrote:
> Do you guys really need a loop for summing a series of integers?!?

I assure you that I don't, which is why I called it
"rather useless" and said there was more to the Haskell
example than a function for the specific task of summing
sequences of consecutive integers.

> Homework #1: name the matemathician who was asked by a teacher to sum
> all integers  between 1 and 100 in the hope that he is going to sit
> tight for a good while (no HP calculators that time).

For extra credit, name the teacher. (No, the teacher wasn't
anyone famous.)

> Homework #2: generalize the above algorithm and write a CL function that
> sums [n .. m] in O(1) time.

O(log n log log n) or something of the sort, surely? :-)

--
Gareth McCaughan  Gareth.McCaug...@pobox.com
sig under construc


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rainer Joswig  
View profile  
 More options Nov 2 2000, 8:28 pm
Newsgroups: comp.lang.lisp
From: Rainer Joswig <jos...@corporate-world.lisp.de>
Date: Fri, 03 Nov 2000 02:26:57 +0100
Local: Thurs, Nov 2 2000 8:26 pm
Subject: Re: My opinion re LISP
In article <3A020211...@synquiry.com>, Jon S Anthony <j...@synquiry.com>
wrote:

Well this brings us to another nice feature of
Common Lisp: Compiler Macros.

; Well, let's optimize atleast a bit for speed and less debugging
(proclaim '(optimize (speed 2) (safety 1) (debug 1)))

; our iota
(defun iota (n)
  (loop for i upto n collect i))

; our naive sum
(defun sum (list)
  (reduce #'+ list))

; let's try it. conses the intermediate list
(sum (iota 100))

; let's define the shortcut from Mr. Gauss
(defun sum-iota (n)
  (/ (* n (1+ n)) 2))

; see it work. No list involved.
(sum-iota 100)

; Now a compiler macro. If we see a form (sum (iota something)) we replace it
; by (sum-iota something).
(define-compiler-macro sum (&whole form arg)
  (cond ((and (listp arg)
              (eq (first arg) 'iota))
         `(sum-iota ,(second arg)))
        (t form)))

; trace sum-iota
(trace sum-iota)

; a test, should do the usual reduce
(defun test0 ()
  (sum '(1 2 3)))
(test0)

; another test. should be optimized. no intermediate list.
(defun test ()
  (sum (iota 100)))
(test)

; we change the implementation.
; let's define an assoc-list of ( test-function transformer-function)
; this let's us add new optimizers at any time, by adding to this assoc-list.
(defparameter *sum-transformers*
  `((,(lambda (form)
        (and (listp form)
             (eq (first form) 'iota)))
     ,(lambda (form)
        `(sum-iota ,(second form))))
    (,(lambda (form)
        (and (listp form)
             (eq (first form) 'quote)))
     ,(lambda (form)
        (sum (first (rest form)))))))

; Okay, the simplified compiler macro
(define-compiler-macro sum (&whole form arg)
  (let ((transformer (second (assoc arg *sum-transformers*
                                    :test (lambda (form test-fn)
                                            (funcall test-fn form))))))
    (if transformer
      (funcall transformer arg)
      form)))

; trace everything
(trace iota reduce sum)

; a few tests. See when the functions are being called,
;  by the compiler or at runtime

(defun test0 ()
  (sum '(1 2 3)))
(defun test1 ()
  (sum (iota 100)))
(defun test2 (list)
  (sum list))

(test0)
(test1)
(test2 '(1 2 3 4))

Pretty cool...

--
Rainer Joswig, Hamburg, Germany
Email: mailto:jos...@corporate-world.lisp.de
Web: http://corporate-world.lisp.de/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jon S Anthony  
View profile  
 More options Nov 3 2000, 3:00 am
Newsgroups: comp.lang.lisp
From: Jon S Anthony <j...@synquiry.com>
Date: 2000/11/03
Subject: Re: My opinion re LISP

Mario Frasca wrote:

> On Thu, 02 Nov 2000 19:08:49 -0500, Jon S Anthony <j...@synquiry.com> wrote:
> >Robert Monfera wrote:
> >> Homework #2: generalize the above algorithm and write a CL function that
> >> sums [n .. m] in O(1) time.

> >= m(m+1)/2 - n(n-1)/2

> you're not generalizing, you're just using the above algorithm.
> a generalisation would be:

> = (m-n+1)(m+n)/2

I'd call this a reduction, not a generalization.

> which has the same form as 'm(m+1)/2'

Change this to k(k+1)/2 so we don't mix up our m's and n's :-).
Given this, I am unsure why you think your reduced version is
of the same form.  k can't be m or n here, nor does it work for
either of (m-n) or (m+n).  What am I missing?

/Jon

--
Jon Anthony
Synquiry Technologies, Ltd. Belmont, MA 02478, 617.484.3383
"Nightmares - Ha!  The way my life's been going lately,
 Who'd notice?"  -- Londo Mollari


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 76 - 100 of 109 < Older  Newer >
« Back to Discussions « Newer topic     Older topic »