Duel, Apl, and the shortest program to find prime numbers

Hi!

I wonder how many characters is the shortest program to find the first

10 prime numbers over 1000, in APL ....

Background: I am the developer of Duel, a language for C debugging.

I have never used APL seriously, though I'm aware of the semantics,

some of which found their way into Duel. What is Duel? under gdb,

given array x[100] of structs with field level, you could do:

(gdb) dl x[..100].level >? 0

x[42].level = 5

x[67].level = 19

That is, find x[i].level that are positive (the nice symbolic output is

automatic). care for more details? anon ftp to: ftp.cs.princeton.edu:/duel.

Anyway, I needed some prime numbers over 1000, and I ended up using Duel!

This raises the question of whether Duel provides anything interesting to

people who use APL one-liners, or plain old Unix 'bc'.

To get the first 10 prime numbers over 1000, in Duel:

(all the spaces are redundant. x=>y creates an implied loop over x, returning

y, where _ is the index of the loop)

(1000.. => if(&&/( 2,3.._-1 => __%_)) _ )[[..10]]

How much work it takes in APL? Duel uses Icon-like generators, so the above

is iterative, not lists/arrays manipulations. The above code does not

assume, e.g. that there must be 10 primes between 1000 and 2000.

Comments appreciated!

Michael Golan