This seems to work:

( p: @: i. @: (p:^:_1))  30

A thing to remember:

  f g h x

is not the same as

  (f g h) x

but _is_ the same as

  (f @: g @: h) x

------------------------------------------------------------------------
|\/| Randy A MacDonald   | APL: If you can say it, it's done.. (ram)
|/\| [EMAIL PROTECTED]  |
|\ | |If you cannot describe what you are doing BSc(Math) UNBF'83 |as a process, you don't know what you're doing. Sapere Aude | - W. E. Deming Natural Born APL'er | Demo website: http://156.34.93.148/
-----------------------------------------------------(INTP)----{ gnat }-

----- Original Message ----- From: "Yuvaraj Athur Raghuvir" <[EMAIL PROTECTED]>
To: "Programming forum" <[email protected]>
Sent: Wednesday, September 20, 2006 8:51 PM
Subject: [Jprogramming] Explicit to Tacit - newbie question


Hello,

J is fascinating. Am learning slowly....

In the following why does pl not work?

  n =. 30
  p:^:_1 n
10
  p: i. p:^:_1 n             NB. list of primes less than n
2 3 5 7 11 13 17 19 23 29
  pl =. p: i. p: ^: _1
  pl n                          NB. Does not work!
1
  p: i. (p: ^: _1) 30
2 3 5 7 11 13 17 19 23 29
  pl =. p: i. (p:^:_1)      NB. Is it a paranthesis problem?
  5!:5 < 'pl'                  NB. J removes the paranthesis anyways...
p: i. p:^:_1


Regards,
Yuva
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to