The Lambda Lab
/
projects
/
forth.jl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ported last of relevant jonesforth library code.
[forth.jl.git]
/
examples
/
mandelbrot.4th
diff --git
a/examples/mandelbrot.4th
b/examples/mandelbrot.4th
index
d31b028
..
b8195f4
100644
(file)
--- a/
examples/mandelbrot.4th
+++ b/
examples/mandelbrot.4th
@@
-1,7
+1,7
@@
( --- Complex arithmetic --- )
( Location of floating point. )
( --- Complex arithmetic --- )
( Location of floating point. )
-: precision 10000 ;
+10000 value precision
: sign dup abs / ;
: sign dup abs / ;
@@
-47,11
+47,13
@@
2over 2swap csq c+
;
2over 2swap csq c+
;
+100 value maxiter
+
: inSet? ( cr ci -- res )
0 0 ( z_0 = 0 )
true ( flag indicating set membership )
: inSet? ( cr ci -- res )
0 0 ( z_0 = 0 )
true ( flag indicating set membership )
-
100
0 do
+
maxiter
0 do
drop
iterate
drop
iterate
@@
-68,11
+70,15
@@
-rot 2drop -rot 2drop
;
-rot 2drop -rot 2drop
;
-: xsteps 100 ;
-: ysteps 30 ;
+100 value xsteps
+30 value ysteps
+
+: mandelDomain
+ -2 0 >scaled -1 0 >scaled 0 5 >scaled 1 0 >scaled
+;
( Draw the Mandelbrot Set!)
( Draw the Mandelbrot Set!)
-: mandel ( x1 y1 x2 y2 -- )
+: mandel
Draw
( x1 y1 x2 y2 -- )
0 pick 3 pick - ysteps /
1 pick 4 pick do
0 pick 3 pick - ysteps /
1 pick 4 pick do