I installed maze solver at rosetta code.

http://rosettacode.org/wiki/Maze_solving#J

path =. 3 : 0
  p =. <:#y
  while. _ > {:p do.
    p =. p,y{~{:p
  end.
  |.}:p
)
   path _ 0 1 1 2 NB. vector of "prior cell", start on right
0 1 2 4

It seems that path could be tacit.

On the other hand, I just wrote Ramanujan's approximation to the
perimeter of ellipse and was simply astounded by j simplicity.
Snippet:

h =: - % +

h[a_,b_] := (a-b)/(a+b)

def h(a,b):
    return (a-b)/(a+b)

double h(double a, double b) {
  return (a-b)/(a+b);
}


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

Reply via email to