By the way Yuvaraj,
If you want something that looks like:
name =: (f g h)
name y
name y
to act like
f g h y
I suggest you use Paul Chapman's "ats" utility. He contributed it here:
http://www.jsoftware.com/pipermail/general/2003-August/015037.html
but the web interface to the message has coerced all instances of "@" to the
word "at". (which is particularly bad in this case because the function
defines a name "at" and the entire post is about inserting "@" characters).
Here is the correct definition:
conjs =: 2 : 0
a =. a: 0}]`x.
lh =. >@{.
rh =. >@{:
list =. <@,"0 '32'
isEmpty =. 0: = #
isTrain =. +.`*./ @: ((=&list @: {. @: rh) , [EMAIL PROTECTED])
isDone =. [EMAIL PROTECTED]
curtail =. }: @: > @: {: @: rh
tail =. {: @: > @: {: @: rh
caseTrain =. (lh , curtail) ; tail
caseNotrain =. (lh , {:) ; a:"_
switch =. isTrain (+ +:) isDone
step =. caseNotrain`caseTrain`] @. switch
b =. >{.step^:_ a
c =. ({.b) , <}.b
at =. (<y.)"_
caseAtop =. (at , (<@lh <@, [EMAIL PROTECTED])) ,&< [EMAIL
PROTECTED]
d =. {.(caseAtop`] @. isDone)^:_ c
d 5!:0
)
Here's an example of how you can use it:
pl =. (p: i. p:^:_1) ats
pl 30
2 3 5 7 11 13 17 19 23 29
I recommend putting this definition in your startup script so you can use it at
will. Your startup script is the one named at Edit>Configure>Startup>Startup
Script (which is jpath '~config\startup.ijs' by default).
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm