Because of my slow old brain, I only reply to the second part :-)
Part of me wonders in Haskell-world, so:
dbJQ = (\xs -> filter (`notElem`[ a*b | a <- xs, b<- xs]) xs ).
enumFromTo 2. succ
Dan Bron schreef:
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.
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm