Company
Date Published
Author
Christoffer Bergman
Word count
1549
Language
English
Hacker News points
None

Summary

The author of the blog post is attempting to generate a Mandelbrot fractal using Cypher, a query language for graph databases. The fractal is represented as an ASCII art image, where each pixel is assigned a color based on the number of iterations it takes for the corresponding point in the fractal to "escape". The author uses the `reduce()` function in Cypher to iterate over the pixels and perform the Mandelbrot calculation. The `reduce()` function is used to aggregate values from an iterable, in this case, a list of objects representing the pixels. The function iterates 100 times for each pixel, updating the values of `zx` and `zy` according to the Mandelbrot equation, and assigns an ASCII character based on the number of iterations. The final result is a string representation of the fractal, where each character corresponds to a specific color in the image. The author's goal was to test implementing an iterative algorithm in a declarative language like Cypher, and they successfully demonstrated the power of the `reduce()` function in this context.