Hi Alex, Joh-Tob,
A 'co may be exactly what I am looking for in this case. Thanks!
Generating all the states at once was nice in one sense as I could
immediately scale the view when rendering the results.
Picolisp easily supported lists of ~2M elements on the 4GB, single-core
virtual box I am currently using.
The code below is the recursive Gosper implementation I came up with that
uses very little stack. This version just emits states.
It should be easy to adapt to other L-systems, but doesn't yet have the
state management needed to 'grow' fractal plants.
If you want to "space-fill" (
https://en.wikipedia.org/wiki/Space-filling_curve) your hard drive with a
Gosper, or similar, curve...
This will do it for you ;)
: (out "test.dat" (nil (GosperR 10)))
: (call 'ls "-l")
-rw-r--r-- 1 llawrence llawrence 659108913 Mar 3 14:58 test.dat
Just counting the state changes emitted...
: (bench (nil (GosperR 10)) (msg (text "EmitCount: @1" EmitCount)))
: (bench (nil (GosperR 11)) (msg (text "EmitCount: @1" EmitCount)))
Picolisp continues to impress me with its expressiveness and power.
# Recursive L-system emitter
(de Plot (L)
(map '((X) (prin (car X))) L) )
(de Fn (L)
((= X "A") A)
((= X "B") B)
(T X) ) )
L ) )
R ) )
(de L-Run (L D)
((>= D MaxDepth) (Plot L))
(L-Run (Fn (list (car X))) (inc D)) )
L ) ) ) )
(de GosperR (MaxDepth)
(let (A (chop "A-B--B+A++AA+B-")
B (chop "+A-BB--B-A++A+B"))
(default MaxDepth 2)
(L-Run A 1) ) )
On Fri, Mar 3, 2017 at 11:04 AM, Alexander Burger <a...@software-lab.de>
> On Fri, Mar 03, 2017 at 01:39:25PM +0100, Joh-Tob Schäg wrote:
> > I haven't figured out how to do it yet, but I think, in this case, a
> > 'recursive' solution that renders as points are created would use a lot
> > less resources, assuming that processed replacement rules are garbage
> > collected as the stack unwinds and elements are traversed over.
> > This sound like a case for 'co
> Makes sense probably.
> ♪♫ Alex
> UNSUBSCRIBE: mailto:firstname.lastname@example.org?subject=Unsubscribe