(#~ ] -.@:e. [: , */~)@:(2 + i.)
(#~ ] -.@:e. [: , */~)@:(2 + i.) 3
(#~ ] -.@:e. [: , */~) 2 + 0 1 2
(#~ ] -.@:e. [: , */~) 2 3 4
2-seq #~ 2-seq -.@:e. razed mtab 2-seq
4 is in mtab, so "not e." is probably primes?
--- Dan Bron <[EMAIL PROTECTED]> wrote:
> So, we often hear complaints that J is terse to the point of being cryptic.
> That it is
> unreadable. Let's see if that's true.
>
> Here's a piece of J code I adapted from some APL I came across on the net:
>
> (#~ ] -.@:e. [: , */~)@:(2 + i.)
>
> It's a monad whose input is a scalar integer. What is its output? What does
> the verb do?
>
> Now, no cheating: if J is a notation, then we should be able to read it
> without the aid of the
> interpreter. Don't experiment to deduce its function; don't even validate
> your hypothesis in
> the interpreter. Just work one out and post it here.
>
> You might also post how long it took you to work out, and maybe what your
> thought process was.
> Or post a counter-challenge -- perhaps slightly more difficult.
>
> I'm thinking of involving other communities in this game, so if you have a
> favorite non-J
> language, you could also translate this function into that language (using
> its natural style)
> and post that, too. Whatever you feel like.
____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total
Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm