'("turtlegraphics.txt" loaded)

colors == '(() _super 255 red 0 black 16711680 blue 16777215 white 32768 green 16776960 aqua 
           8421504 darkgray 16711935 fuchsia 8421504 gray 65280 lime 12632256 lightgray 
           128 maroon 8388608 navy 32896 olive 8388736 purple 12632256 silver 8421376 teal 
           65535 yellow 55295 gold 42495 orange)

initturtle == '(turtle :: () stack 0 x 0 y 0 angle true pen 0 color 1 size 16777215 brush)
// use: 'turtle new

draw       == [draw] cb fail     // (((...turtle) draw) eff 'io) ° dict
moveto     == [moveto] swop fail
moverel    == [moverel] swop fail
move       == [move] swop fail
turnto     == [turnto] swop fail
turn       == [turn] swop fail
penup      == [penup] fn fail
pendown    == [pendown] fn fail
pencolor   == [pencolor] swop fail
pensize    == [pensize] swop fail
brushcolor == [brushcolor] swop fail
circle     == [circle] swop fail
rectangle  == [rectangle] fn fail

turtle == .. { dict
   [new]        == initturtle as top°self
   [draw]       == (prop°(quote°reverse°#stack°[0]),'showgraph,(),) app [2]
   [moveto]     == ((self iput 'stack ee prop°([0]°para),([1]°para),(self iget 'stack),)
                   iput 'x ee [0]°para) iput 'y ee [1]°para
   [moverel]    == ((([0]°para)+self iget 'x) ee (([1]°para)+self iget 'y)) moveto self
   [move]       == ( ((([0] iget 'x) + [1]*cos°[2]) ee (([0] iget 'y) + [1]*sin°[2]))
                     °self,para,(self iget 'angle), ) moveto self
   [turnto]     == self iput 'angle ee (para - 2pi*int°para/2pi)
   [turn]       == (para + self iget 'angle) turnto self
   [penup]      == (id iput 'stack ee prop°'false,'pen,#stack,) iput 'pen ee 'false
   [pendown]    == (id iput 'stack ee prop°'true,'pen,#stack,) iput 'pen ee 'true
   [pencolor]   == (self iput 'stack ee prop°(round°para),'color,(self iget 'stack),) 
                   iput 'color ee para
   [pensize]    == (self iput 'stack ee prop°(round°para),'size,(self iget 'stack),) 
                   iput 'size ee para
   [brushcolor] == (self iput 'stack ee prop°(round°para),'brush,(self iget 'stack),) 
                   iput 'brush ee para
   [circle]     == self iput 'stack ee prop°para,'circle,(self iget 'stack),
   [rectangle]  == id iput 'stack ee prop°(),'rect,#stack,
}

// (((f aa)°iota°x) (plot0 eff io) 0-y) ° dict
plot0 == ((prop°(quote°((reverse°(pendown°[0] moveto penup°'turtle new),tail) insr '([0] moveto [1]))
         °transpose°((iota0°length°[0]) ee (+ aa0))),'draw,(),) app [2])°eea // eea?
//plotn


// GNU Lesser General Public License v2.1
