I've write several function that need to used in function mandelbrot to draw it, here are these:
# sp that takes integer n, element y, list xs. insert the specified element y after every n elements.
sp 1 'a' ['b','c','d'] = ['b','a','c','a','d','a']
# plane that gives (x/r,y/r) where x and y are int, -2<x/r<1,-1<y/r<1.
plane 1 = [(-2.0,-1.0),(-1.0,-1.0),(0.0,-1.0),(1.0,-1.0),(-2.0,0.0),(-1.0,0.0),(0.0,0.0),(1.0,0.0),(-2.0,1.0),(-1.0,1.0),(0.0,1.0),(1.0,1.0)]
# orbit, is the same in this question : Haskell infinite recursion in list comprehension
print(take 3 (orbit(2,1))) = [(2,1),(5,5),(2,51)]
# find, is the same in this questionL haskell: recursive function that return the char in a tuple list with certain condition(compare)
print(find 0.4 [(0.15,'#'),(0.5,'x'),(1,'.')]) == 'x' ## >all will print char ' '
So I'm trying to use sp,plane,orbit,and find,this four function with a new func named norm, that calculate the distances of points from the origin:
norm (x,y) = x*x + y*y
Now is my question:
I'm little confused about what should do and why that, so I think I will first use plane to all the points, then use orbit to print the list with the point? And after this, what should I do? Can anyone explain these relationship of each function and what I should do?
Separate code or explanation are fine. The mandelbrot function should draw something that looks like mandelbrot contains '#' 'x' '.' and ' '.