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 |
Posted-Date: | 12 Jun 2006 01:16:57 EDT |
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
Return to the
comp.compilers page.
Search the
comp.compilers archives again.