Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
30
Task/Mandelbrot-set/Lambdatalk/mandelbrot-set.lambdatalk
Normal file
30
Task/Mandelbrot-set/Lambdatalk/mandelbrot-set.lambdatalk
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{def mandel
|
||||
|
||||
{def mandel.r
|
||||
{lambda {:iter :cx :cy :norm :x :y :count}
|
||||
{if {> :count :iter} // then norm < 4
|
||||
then o // inside the set
|
||||
else {if {> :norm 4} // then iter > max
|
||||
then . // outside the set
|
||||
else {let { {:cx :cx} {:cy :cy} {:iter :iter}
|
||||
{:X {+ {* :x :x} -{* :y :y} :cx}} // compute
|
||||
{:Y {+ {* 2 :x :y} :cy}} // z = z^2+c
|
||||
{:count {+ :count 1}}
|
||||
} {mandel.r :iter :cx :cy
|
||||
{+ {* :X :X} {* :Y :Y}} // the norm
|
||||
:X :Y :count} }}}}}
|
||||
|
||||
{lambda {:iter :cx :cy}
|
||||
{mandel.r :iter
|
||||
{+ {* :cx 0.05} -1.50} // centering the set
|
||||
{+ {* :cy 0.05} -0.75} // inside the frame
|
||||
0 0 0 0} }}
|
||||
-> mandel
|
||||
|
||||
We call mandel directly in the wiki page
|
||||
|
||||
{S.map {lambda {:i} {br} // loop on y
|
||||
{S.map {{lambda {:i :j} // loop on x
|
||||
{mandel 20 :i :j}} :i} // compute
|
||||
{S.serie 0 30}}} // x resolution
|
||||
{S.serie 0 40}} // y resolution
|
||||
Loading…
Add table
Add a link
Reference in a new issue