Hi!

I shall replace some text in a vector. My function is
Replace=:13 :'(p{.y),(>1{x),(($>0{x)+p=.I. (>0{x) E. y)}.y'
Example : ('can be';'is') Replace 'Life can be good'
Life is good
I would like to see if there is a better solution, more J-like.

I have also 2 functions for interval:
1) int1=:({.@] < [)*.([ < {:@])
 6 int1 4 9
1
This is very clear how it works.

2) int2=:[: ~:/ >:/~
This is more concise and elegant, but I don't understand how it works.
Can somebody  give me an explanation?
Thanks
Gian Medri
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to