yeah
Moderators: Blip, The_Metatron
...is bounded with z0 = 0 (and that just covers the black parts, which on its own, isn't quite so pretty).Thommo wrote:
A zoomed out image of the mandelbrot set, the set of points in the complex plane for which zn+1 = zn2+c
VazScep wrote:...is bounded with z0 = 0 (and that just covers the black parts, which on its own, isn't quite so pretty).
Alternatively: the set of points c such that the keep set of zn+1 = zn2+c is connected (and these sequences classify the long term behaviour of any quadratic iteration sequence).
BlackBart wrote:Conway's Game of Life
.. that such a childishly simple algorithm can produce such complexity makes me feel dizzy in a good way.
Every program can be given by a term in the untyped lambda calculus, which stands for an object in a Scott domain. Not sure it would be very elegant though.BlackBart wrote:No idea if it can be expressed as a formula. The algorithm is described here; http://mathworld.wolfram.com/GameofLife.html
VazScep wrote:Every program can be given by a term in the untyped lambda calculus, which stands for an object in a Scott domain. Not sure it would be very elegant though.BlackBart wrote:No idea if it can be expressed as a formula. The algorithm is described here; http://mathworld.wolfram.com/GameofLife.html
Relatively recently, functional programmers have noticed that cellular automata are elegantly described by the very general and important notion of a comonad of a very general and important data structure called a zipper. Expressed in this language, you can code up Conway's Game of Life in half a dozen lines of code without ever having to muck around with recursion or loops.
I finally got around to implementing this:BlackBart wrote:VazScep wrote:Every program can be given by a term in the untyped lambda calculus, which stands for an object in a Scott domain. Not sure it would be very elegant though.BlackBart wrote:No idea if it can be expressed as a formula. The algorithm is described here; http://mathworld.wolfram.com/GameofLife.html
Relatively recently, functional programmers have noticed that cellular automata are elegantly described by the very general and important notion of a comonad of a very general and important data structure called a zipper. Expressed in this language, you can code up Conway's Game of Life in half a dozen lines of code without ever having to muck around with recursion or loops.
Interesting! I'll see if I can speed up my clunky life program
type GridCursor a = CursorT (CursorT Identity) a
east :: GridCursor a -> Maybe (GridCursor a)
east = fmap extract . left
west :: GridCursor a -> Maybe (GridCursor a)
west = fmap extract . right
north :: GridCursor a -> Maybe (GridCursor a)
north x = fmap (const $ cohoist (runIdentity . fromJust . left) x) (left . lower $ x)
south :: GridCursor a -> Maybe (GridCursor a)
south x = fmap (const $ cohoist (runIdentity . fromJust . right) x) (right . lower $ x)
neighboursC :: [GridCursor a -> Maybe (GridCursor a)]
neighboursC = [north, north >=> east, east, east >=> south, south, south >=> west,west, west >=> north]
neighboursAlive :: GridCursor Bool -> Int
neighboursAlive = length . filter id . f
where f = fmap catMaybes . sequence . (fmap.fmap.fmap) extract $ neighboursC
conway =
extend (\w ->
if neighboursAlive w < 2 || neighboursAlive w > 3 then False
else if neighboursAlive w == 3 then True else extract w)
IF (real(z) < 0)
z = (z+1)*c
ELSE
z = (z-1)*conj(c)
BlackBart wrote:Conway's Game of Life
.. that such a childishly simple algorithm can produce such complexity makes me feel dizzy in a good way.
Return to The Arts & Entertainment
Users viewing this topic: No registered users and 1 guest