Re: Natural "for" Loop, using Plural / Singular transformations ??

"Jonathan Thornburg" <jthorn@aei.mpg.de>
12 Jun 2006 01:16:58 -0400

          From comp.compilers

Related articles
[2 earlier articles]
Re: Natural "for" Loop, using Plural / Singular transformations ?? dmaziuk@bmrb.wisc.edu (Dimitri Maziuk) (2006-05-30)
Re: Natural "for" Loop, using Plural / Singular transformations ?? mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2006-05-30)
Re: Natural "for" Loop, using Plural / Singular transformations ?? tom@infoether.com (Tom Copeland) (2006-05-30)
Re: Natural "for" Loop, using Plural / Singular transformations ?? 148f3wg02@sneakemail.com (Karsten Nyblad) (2006-06-03)
Re: Natural "for" Loop, using Plural / Singular transformations ?? dot@dotat.at (Tony Finch) (2006-06-05)
Re: Natural "for" Loop, using Plural / Singular transformations ?? p_ludemann@yahoo.com (Peter Ludemann) (2006-06-11)
Re: Natural "for" Loop, using Plural / Singular transformations ?? jthorn@aei.mpg.de (Jonathan Thornburg) (2006-06-12)
Re: Natural "for" Loop, using Plural / Singular transformations ?? haberg@math.su.se (2006-06-12)
Re: Natural "for" Loop, using Plural / Singular transformations ?? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2006-06-15)
Re: Natural "for" Loop, using Plural / Singular transformations ?? gene@abhost.us (Gene Wirchenko) (2006-06-27)
Re: Natural "for" Loop, using Plural / Singular transformations ?? gene@abhost.us (Gene Wirchenko) (2006-06-27)
| List of all articles for this month |

From: "Jonathan Thornburg" <jthorn@aei.mpg.de>
Newsgroups: comp.compilers
Date: 12 Jun 2006 01:16:58 -0400
Organization: Compilers Central
References: 06-05-083 06-06-004 06-06-035
Keywords: design

Peter Ludemann <p_ludemann@yahoo.com> wrote:
> In designing programming languages, it's useful to have at least a
> passing acquaintance with a few other languages, preferably from another
> language family than your native language. Here's a description of Perl,
> as invented by a Latin-speaker:
> http://www.csse.monash.edu.au/~damian/papers/HTML/Perligata.html
> meo varo haec da. # my $var = @_;
> meis varo haec da. # my ($var) = @_
> meis varis haec da. # my @var = @_;
>
> And, of course, there's the classic (still controversial):
> http://en.wikipedia.org/wiki/Sapir-Whorf_hypothesis


Consider the following basic-computer-science-algorithms exercise:
    Given two lists (1-D arrays) of numbers, suggest a
    "reasonably efficient" algorithm to find all numbers
    which are common to both lists.
There are two obvious algorithms which are faster than O(N^2):
(A) build a hash table of the entries in one list, then walk the
        other list checking the hash table for duplicates
(B) sort both lists, then walk the sorted lists looking for duplicates


I have read (but alas cannot find a reference) that most programmers
(who have a reasonable knowledge of basic algorithms) suggest (A) as
the obvious answer to this exercise, whereas programmers who know the
APL programming language
[which has sorting as a primitive, but not hash tables]
are more likely to suggest (B).


ciao,


--
-- "Jonathan Thornburg -- remove -animal to reply" <jthorn@aei.mpg-zebra.de>
      Max-Planck-Institut fuer Gravitationsphysik (Albert-Einstein-Institut),
      Golm, Germany, "Old Europe" http://www.aei.mpg.de/~jthorn/home.html


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.