comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <eachus@mitre.org>
Subject: Re: histrionics
Date: 1999/09/14
Date: 1999-09-14T22:34:59+00:00	[thread overview]
Message-ID: <37DECE9D.72D1E87E@mitre.org> (raw)
In-Reply-To: 7rcddd$bfd$1@nnrp1.deja.com

Robert Dewar wrote:

> No, again I disagree, the power of very high level languages
> is directly related to the fact that you want to be able
> to describe things at a much higher level, and of course
> the descriptions are shorter. If I can say (this is SETL,
> without the nice character set :-)
> 
> primes = {n in 2 .. 100 |
>            notexists j in 2 .. n - 1 |
>              n mod j = 0};
> 
> that's a WHOLE lot easier to understand than a seive programmed
> in a conventional procedural language. Vladimir, you can supply
> the corresponding prolog program if you like :-) I prefer the
> statement in SETL, since it seems close to the mathematical
> definition of primes, both syntactically and semantically

    I agree, I prefer APL for this kind of thinking even though there is
the problem that you really need to rewrite the "program" in a readable
language once you have it correct.  For example, I know of three short
definitions (taking 18, 17 and 16 characters respectively) for primes. 
The longest--but most efficient, defines a prime as an integer with
exactly two positive integer divisors.  The next definition is that a
prime is an integer that is not a member of the set of products of all
the integers greater than one.  The shortest definition corresponds to
Wilson's theorem:  An integer N is prime iff
(N-1)! is congruent to -1 mod N.

   Note that none of these is the algorithm I would use to find out
whether or not a large integer is prime, but even those algorithms are
easier to think about in a higher level notation that supports number
theory well.

-- 

                                        Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...




  parent reply	other threads:[~1999-09-14  0:00 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-09  0:00 histrionics G
1999-09-08  0:00 ` histrionics Preben Randhol
1999-09-09  0:00   ` histrionics G
1999-09-09  0:00     ` histrionics Nick Roberts
1999-09-09  0:00       ` histrionics Robert Dewar
1999-09-10  0:00         ` histrionics Vladimir Olensky
1999-09-10  0:00           ` histrionics Robert Dewar
1999-09-10  0:00             ` histrionics Ted Dennison
1999-09-11  0:00               ` histrionics Bob Collins
1999-09-12  0:00                 ` histrionics Vladimir Olensky
1999-09-13  0:00                 ` histrionics Ted Dennison
1999-09-11  0:00             ` histrionics Vladimir Olensky
1999-09-11  0:00               ` histrionics Robert Dewar
1999-09-11  0:00                 ` histrionics Vladimir Olensky
1999-09-14  0:00                 ` Robert I. Eachus [this message]
     [not found]                   ` <7s2l7b$kmr$1@nnrp1.deja.com>
     [not found]                     ` <37E81661.6DCA23E4@mitre.org>
     [not found]                       ` <7saju5$6h6$1@nnrp1.deja.com>
1999-09-22  0:00                         ` histrionics Robert I. Eachus
1999-09-22  0:00                       ` histrionics Ehud Lamm
1999-09-22  0:00                       ` histrionics p.obry
1999-09-23  0:00                   ` histrionics Ehud Lamm
1999-09-23  0:00                     ` histrionics Ehud Lamm
1999-09-23  0:00                     ` Sums of cubes (was Re: histrionics) Robert I. Eachus
1999-09-24  0:00                       ` Robert Dewar
1999-09-24  0:00                         ` Robert I. Eachus
1999-09-24  0:00                       ` Wes Groleau
1999-09-25  0:00                         ` Robert Dewar
1999-09-24  0:00                       ` Wes Groleau
1999-09-24  0:00                         ` Robert I. Eachus
1999-09-27  0:00                           ` Wes Groleau
1999-09-11  0:00               ` histrionics Robert Dewar
1999-09-11  0:00                 ` histrionics Vladimir Olensky
1999-09-13  0:00                   ` histrionics Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox