# Question:Convert Peano curve into a function

## Question:Convert Peano curve into a function

Maple 15

Hi!

I have seen th following procedure to compute the image of the points of [0,1] under the so called Peano space-filling curve (sorry, I have to pasted the code in "text plane" mode):

P[0] := (x, y) -> ((1/3)*y, (1/3)*x);

P[1] := (x, y) -> (-(1/3)*x+1/3, (1/3)*y+1/3);

P[2] := (x, y) -> ((1/3)*x, (1/3)*y+2/3);

P[3] := (x, y) -> ((1/3)*x+1/3, -(1/3)*y+1);

P[4] := (x, y) -> (2/3-(1/3)*y, 2/3-(1/3)*x);

P[5] := (x, y) -> ( (1/3)*x+1/3, 1/3-(1/3)*y));

P[6] := (x, y) -> (1/3)*x+2/3, (1/3)*y);

P[7] := (x, y) -> (-(1/3)*x+1, (1/3)*y+1/3);

P[8] := (x, y) -> ((1/3)*x+2/3, (1/3)*y+2/3);

peano := proc (t::numeric, depth::integer)

local q, r; global P;

if depth = 0 then return 0, 0 end if;

q := floor(9*t); r := 9*t-q;

return P[q](peano(r, depth-1))

end proc;

Now, I need to use the procedure "peanofun" as a function. For instance, if we define f:=(x,y)->x+y, I need to use (plot, compute, etc) for instance, the function f(peanofun(t,5))

Can you help me with this issue, please?