Blog › ICP guides

Logo developer on retainer: turtle graphics, recursive procedures, repeat loops, list operations, and Logo educational language engineering on monthly retainer

November 1, 2026 · ~18 min read

A Logo-based computational art program was generating wrong tree shapes eight times per day. The program included a recursive tree-drawing procedure that called itself twice — once to draw the left sub-branch and once to draw the right sub-branch. Each branch required the turtle to turn, draw forward, recurse to draw a smaller tree at the branch tip, then return to the branch base for the next branch. The procedure used setpos to restore the turtle’s position after each recursive call, correctly returning the pen to the branch base. But it did not restore the turtle’s heading. After the left-branch recursive call completed, the turtle was pointing in whatever direction the final step of that recursive sub-tree left it — not the direction needed to draw the right branch. The right branch was drawn from the correct position but at the wrong angle, producing a misaligned tree shape. The Logo developer on retainer diagnosed the root cause: the procedure captured the turtle’s position with pos before each recursive call but did not capture its heading with heading. The fix stored the heading in a local variable before each recursive call and called setheading with the saved value after the recursive call returned, restoring both position and orientation. Wrong tree shapes per day: 8 → 0.

The work log entry read “fixed tree procedure heading bug, 12h.” It names the symptom and the duration. It cannot explain to a client why heading state is separate from position state in Logo’s turtle model (the turtle maintains xcor, ycor, and heading as three independent values; setpos restores only the coordinate pair while heading retains whatever the last right or left command left it at), why savestate/restorestate exists in some Logo variants but not others (UCBLogo implements them as convenience wrappers; bare Logo requires explicit pos/heading capture and restore; the retainer’s first task was variant identification), why a recursive tree procedure must save and restore state at each level rather than relying on recursive unwinding (each recursive call may draw additional geometry that leaves the turtle in an unpredictable state; there is no automatic state restoration on return), or why the fix required storing heading in a local variable using local "h make "h heading rather than a global variable (a global variable would be overwritten by the next level’s recursive call before the current level read it back). The 12 hours of turtle state model analysis, pos/heading getter audit, Logo variant identification, local variable scoping investigation, recursive call trace, and regression testing are not visible in the diff beyond a few additional lines in the procedure body.

Logo’s turtle graphics system: movement, heading, drawing modes, and boundary behavior

Logo was designed by Seymour Papert and colleagues at MIT in the late 1960s as a Lisp-based language for educational computing, with turtle graphics as its defining feature. The turtle is a cursor on the screen with a position (x, y coordinates) and a heading (direction in degrees, 0 pointing up/north by convention). The fundamental movement commands: forward N (or fd N) moves the turtle N steps in the direction it is currently facing; back N (or bk N) moves backward. Turning commands: right D (or rt D) turns the turtle clockwise by D degrees; left D (or lt D) turns counterclockwise. Absolute positioning: setx X moves to x-coordinate X; sety Y moves to y-coordinate Y; setpos [X Y] moves to the coordinate pair. home returns the turtle to the origin (0, 0) with heading 0. State getters: xcor returns the current x-coordinate; ycor returns y; pos returns the coordinate pair as a list [x y]; heading returns the current direction in degrees; setheading D sets the heading absolutely.

Drawing mode commands control whether the turtle draws as it moves. pendown (or pd) puts the pen down; subsequent movement draws on the canvas. penup (or pu) lifts the pen; subsequent movement repositions the turtle without drawing. penerase (or pe) sets the pen to erase mode, removing drawn lines as the turtle moves over them. setpencolor N sets the pen color from a palette; setpensize N sets the line width. clean clears the drawing without moving the turtle; clearscreen (or cs) clears the drawing and returns the turtle to home. Boundary mode commands control what happens when the turtle reaches the edge of the drawing area: wrap causes the turtle to appear on the opposite side (modular arithmetic on coordinates); window allows the turtle to move off-screen indefinitely; fence prevents movement past the edge (the turtle stops at the boundary). The boundary mode selection is a common retainer configuration task: educational drawing programs typically use wrap for infinite canvas effects; engineering visualization programs use fence to prevent out-of-bounds positioning.

The turtle state problem that caused the tree procedure bug arises from the independence of position and heading state. A procedure that saves pos before calling a sub-procedure and restores it after correctly returns the turtle to the same (x, y) coordinates, but the heading is whatever the sub-procedure left it at. If the sub-procedure involves any turns or recursive calls that involve turns, the heading after the sub-procedure call is not predictable from the caller’s perspective without reading the sub-procedure’s implementation. The Logo programming pattern for reliable recursive state management: before a recursive call, capture both position and heading (make "saved_pos pos make "saved_heading heading); after the recursive call returns, restore both (setpos :saved_pos setheading :saved_heading). UCBLogo provides savestate and restorestate as convenience wrappers for this pattern. In Logo variants without these primitives, the pattern must be implemented with explicit local variable capture. The most common retainer mistake in recursive Logo programs is saving position but not heading, producing the tree-branch misalignment class of bug.

Logo’s coordinate system places the origin at the center of the screen. Positive x is right; positive y is up. A heading of 0 points toward positive y (up). A heading of 90 points toward positive x (right). This differs from mathematical convention where 0 points right and angles increase counterclockwise; in Logo, angles increase clockwise (right turns increase heading). The retainer headings-audit task: for any Logo program that draws rotational patterns, verify that the clockwise convention is correctly applied in all right and left commands and that expected symmetry holds at known test cases. Symmetric patterns that appear rotated by 90 degrees are the diagnostic signature of a convention confusion between Logo’s clockwise-from-north heading system and a conventional counterclockwise-from-east coordinate system.

Logo procedures, control flow, recursion, and variable scope

Logo procedure definitions use the to/end syntax. A procedure with no parameters: to square fd 100 rt 90 fd 100 rt 90 fd 100 rt 90 fd 100 rt 90 end defines a procedure named square that draws a 100-unit square. Procedures with parameters prefix parameter names with colons in the header: to square :size fd :size rt 90 fd :size rt 90 fd :size rt 90 fd :size rt 90 end. The parameter :size is accessed with the colon prefix anywhere in the procedure body. To return a value from a procedure (making it an operation rather than a command), use output value: to double :n output :n * 2 end. A procedure that should stop without returning a value uses stop. The distinction between output (returns a value that the caller uses) and stop (terminates the procedure with no return value) is Logo’s version of the function vs. procedure distinction in other languages. Confusing output and stop in recursive procedures produces the common retainer bug where a recursive base case uses stop but the recursion expects an output value from the base case.

Logo’s primary iteration primitive: repeat N [commands] executes the commands block exactly N times. Inside a repeat block, repcount returns the current iteration number (1-indexed). For indefinite loops: forever [commands] runs until a throw "toplevel or the user interrupts the program. Conditional loops: while [condition] [commands] repeats as long as condition is true (UCBLogo); until [condition] [commands] repeats until condition becomes true. Conditionals: if condition [commands] executes commands if condition is true; ifelse condition [then-commands] [else-commands] branches based on condition. Alternate forms: test condition stores the result of a boolean test; iftrue [commands] executes if the last test was true; iffalse [commands] executes if the last test was false. Non-local exit: catch "name [commands] establishes a catch block; throw "name exits the enclosing catch block, enabling break-out of nested loops without modifying flag variables. This is the Logo equivalent of a labeled break in other languages.

Variable binding in Logo: make "name value creates or updates a variable named name (the quote-name syntax is Logo’s way of naming a variable as a literal without evaluating it). :name reads the value of variable name. By default, make creates a variable in the global scope, visible everywhere in the program. Procedure parameters are local by default. To create a local variable inside a procedure: local "name declares the variable as local, making subsequent make "name ... assignments affect only the current procedure’s scope. Without local, a make inside a procedure that uses the same name as a global variable modifies the global, which is the common retainer bug in recursive Logo programs: a recursive procedure that modifies a variable without declaring it local corrupts state that outer recursion levels depend on. thing "name is an alternate form of :name that allows dynamic variable access — thing evaluates its argument as a variable name, enabling Logo programs to look up variables by computed names.

Logo’s recursion model is direct recursion: a procedure calls itself by name. There are no iteration primitives in pure Logo that cannot be implemented with recursion; the recursion-first philosophy was part of Logo’s educational design. A recursive countdown: to countdown :n if :n = 0 [stop] print :n countdown :n - 1 end. A recursive list-reversal: to myreverse :lst if empty? :lst [output []] output sentence myreverse butfirst :lst first :lst end. The pattern for mutually tail-recursive procedures (simulating a loop with state passing): to loop :state if stopcondition :state [output :state] loop updatestate :state. Tail-call optimization in UCBLogo means that deeply recursive programs do not overflow a call stack in practice. Logo’s approach to recursion as a first-class programming technique, rather than an advanced topic, has made Logo a preferred language for teaching recursive thinking in computer science education for five decades.

Logo list operations, word primitives, database, and Logo variants

Logo’s data model is built on lists and words. A list is a sequence of elements: [1 2 3], [hello world], [[nested] [lists]]. A word is an atomic value: a number, a quoted string, or an unquoted bareword. List selectors: first [a b c] returns a; last [a b c] returns c; butfirst [a b c] (or bf) returns [b c]; butlast [a b c] (or bl) returns [a b]. List constructors: fput "x [b c] prepends, returning [x b c]; lput "z [a b] appends, returning [a b z]; list "a "b constructs a two-element list; sentence "a [b c] flattens one level of nesting, returning [a b c]. Membership and counting: count [a b c] returns 3; member? "b [a b c] returns true; empty? [] returns true for the empty list. The distinction between fput and lput is the most common source of reversed-list bugs in Logo retainer code: building a list by repeatedly prepending with fput accumulates elements in reverse order; building by appending with lput preserves order at the cost of O(n) per append. Logo’s idiomatic recursive list-building uses fput with a final reverse call for O(n) overall cost.

Logo’s database is a built-in assertion store in UCBLogo. add thing adds an item to the database; remove thing removes it; present? thing tests membership; foreach :database [actions] iterates all database items. The database supports Logo’s educational AI programming model: students can implement simple forward-chaining expert systems by adding assertions (facts) and checking them with present? in condition tests. This is the Logo analog of Prolog’s fact database and Pop-11’s add/remove/present operations. The retainer task of database management in Logo programs focuses on lifecycle discipline: flushing stale assertions between problem-solving episodes to prevent contamination, using present? checks before queries to avoid false matches on old state, and structuring assertion formats consistently so that member? and present? comparisons match the format used by add.

Logo variants differ significantly in capability and target use. UCBLogo (Brian Harvey’s Berkeley Logo) is the reference implementation for procedural Logo programming: full recursion, first-class procedures, apply for higher-order programming, file I/O with openread/openwrite, and a complete list/word library. It is the Logo variant used in most university computational thinking courses and the basis for most Logo documentation. NetLogo (Wilensky, 1999, Northwestern) extends Logo for agent-based modeling: multiple turtle populations defined with breed [wolves wolf] declarations; patches (grid cells with their own variables and behaviors); links between turtles; ask to execute commands as a specific agent; with [condition] to filter agent sets; and built-in charts and histograms for simulation output. NetLogo is used in computational social science, ecology, and complexity science for multi-agent simulations. StarLogo (also from MIT Media Lab) targets massively parallel turtle populations for simulating emergent phenomena. LogoWriter embeds Logo in a word processor context for document-embedded drawing programs used in K-8 education. Retainer variant-selection work involves auditing the use case (single-turtle drawing: UCBLogo; multi-agent simulation: NetLogo; educational document: LogoWriter) and porting programs between variants when institutional infrastructure changes.

Logo arithmetic and boolean primitives: sum 3 4 (or 3 + 4), difference 7 3, product 4 5, quotient 10 3 (integer division), remainder 10 3 (modulo), power 2 8, sqrt 16. Comparison predicates: equal? 3 3, greater? 5 3, less? 2 4, not true, and true false, or false true. Numeric predicates: number? "3 returns true; list? [1 2] returns true; word? "hello returns true; empty? [] returns true. String (word) operations: word "hello "world concatenates words; count "hello returns 5; item 2 "hello returns e (1-indexed character access). The arithmetic-vs-boolean namespace: Logo’s arithmetic operators are procedures that return values; they are not infix by default in bare Logo but many implementations add infix support as syntactic sugar. The retainer audit task of arithmetic expression correctness involves verifying that compound expressions use Logo’s prefix procedure syntax correctly when infix sugar is not available.

How HourTab tracks Logo developer retainer hours

Logo retainer work shares the invisible-work problem common to all educational language retainers, with the additional challenge that Logo’s most important retainer tasks — recursive procedure heading-state repair, control flow restructuring from repeat to forever/while, list-construction orientation correction (fput vs. lput), Logo variant selection and porting, and database assertion lifecycle management — produce diffs whose surface area is small relative to the analytical work required. Adding heading capture and restore to a recursive tree procedure is a diff with four lines; the value is correct recursive geometry, elimination of branch misalignment in all recursive depths, and a procedure structure that correctly implements the save-restore pattern for the Logo turtle’s independent position and heading state. Restructuring a repeat loop with a hard-coded counter into a forever loop with an explicit stopping condition is a diff with six lines; the value is correct loop termination behavior when animation frame timing varies, elimination of premature loop exit bugs, and a control structure that correctly models the indefinite iteration the program requires. Correcting a fput/lput reversal in a list-building procedure is a diff with one token; the value is correctly ordered list output for all inputs and elimination of the systematic reversal that affected every list the procedure produced.

HourTab gives Logo developers a public retainer-hours URL they send to clients — typically K-12 educational technology teams using Logo for computational thinking curricula, university courses using UCBLogo to teach recursion and list processing, NetLogo simulation researchers in social science and ecology, and educational computing organizations maintaining Logo-based learning environments — at the start of an engagement. For Logo retainers, each work log entry should name the mechanism (savestate/restorestate heading-state design for recursive procedures; wrap/window/fence boundary mode selection; penup/pendown/penerase drawing mode management; setx/sety/setpos/home positioning; to procname :param ... end procedure authorship; output return value design; stop void-return design; local/make variable binding; recursive procedure architecture; repeat N [...] block design; forever [...] animation loop; while/do conditional loop; if/ifelse/test/iftrue/iffalse branching; first/last/butfirst/butlast selector design; fput/lput/list/sentence construction; database add/remove/present assertion store; UCBLogo/NetLogo/StarLogo/LogoWriter variant API differences), the specific procedure name and the heading-state or list construction problem, and the before/after observable metric. Logo retainers are often compared to Scheme developer retainers for Lisp-family recursive programming work, to Forth developer retainers for stack-based educational language work, and to Smalltalk developer retainers for educational object-oriented language engineering. The distinction from Scheme is Logo’s turtle graphics model: Logo’s most common retainer work involves turtle state management in recursive drawing procedures, not continuation or macro design as in Scheme. HourTab’s work log makes the heading-state analysis and recursive state management design visible to clients who would otherwise see only the symptom — wrong tree shapes or reversed list outputs — and not understand why the fix required understanding Logo’s independent position/heading turtle model and the save-restore pattern for correct recursive procedure state management.

Track Logo developer retainer hours without the status emails

HourTab gives Logo developers a public URL per client retainer. One link, no login, live burn-down. Your clients stop asking “how many hours do I have left?” and your work log becomes the proof of value that gets the retainer renewed.

See HourTab pricing →

FAQ: Logo developer retainers

What does a Logo developer on retainer typically do?

A Logo developer on monthly retainer covers four principal service areas: turtle graphics procedure design and state management (saving and restoring both pos and heading before/after recursive calls; savestate/restorestate wrapper design; wrap/window/fence boundary mode selection; penup/pendown/penerase drawing mode management; heading-drift analysis in recursive fractal procedures); control flow and procedure architecture (to procname :param ... end procedure authorship; output vs stop return design; local/make variable binding for scope isolation; repeat N [...]/forever [...]/while/do loop design; if/ifelse/test/iftrue/iffalse branching; catch/throw non-local exit for nested loop escape); list operations (first/last/butfirst/butlast selectors; fput/lput/list/sentence construction; count/word/thing primitives; recursive list-processing procedures; database add/remove/present/foreach assertion store); and Logo variant selection (UCBLogo for procedural Logo; NetLogo for multi-agent simulation; StarLogo for parallel turtle populations; LogoWriter for document-embedded drawing; porting between variants).

What Logo work is most commonly underlogged in a retainer?

Recursive procedure heading-state repair (tree procedure restoring pos but not heading; 8 wrong tree shapes/day; added make "h heading before recursive call and setheading :h after; wrong shapes: 8/day → 0; 12–22 hrs invisible in turtle state model analysis, local variable scope design, and recursive call trace), control flow restructuring (repeat with hard-coded counter terminating early when frame timing varies; restructured with forever loop and explicit stopping condition; premature terminations: 5/session → 0; 9–16 hrs invisible in loop design and stopping condition analysis), and list-construction orientation correction (fput building lists in reverse order; replaced with lput at the correct boundary; reversed list outputs: 4/day → 0; 8–14 hrs invisible in fput/lput distinction analysis and list-order audit).

What are typical Logo developer retainer rates?

Entry-level Logo developers (1–2 years, basic turtle graphics commands, repeat loops, to/end procedure definitions, first/butfirst list selectors) bill at $45–$80/hr. Mid-level Logo engineers (2–4 years, recursive procedure design with heading-state management, forever/while control flow, list recursion with fput/lput/sentence, Logo database operations, UCBLogo vs NetLogo variant differences) bill at $80–$145/hr. Senior Logo architects (4–8 years, NetLogo multi-agent simulation design, StarLogo parallel turtle populations, LogoWriter document-embedded programs, complex recursive fractal procedures, Logo educational curriculum integration) bill at $130–$235/hr. Monthly retainer ranges: $1,500–$3,500/mo advisory (15–25 hrs), $5,000–$14,000/mo for full Logo platform engagements.

What should a Logo developer retainer agreement include?

A Logo developer retainer agreement should specify: turtle graphics scope (savestate/restorestate heading-state design; wrap/window/fence boundary mode; penup/pendown/penerase drawing modes; setx/sety/setpos/home positioning); procedure design scope (to procname :param ... end authorship; output vs stop return; local/make binding; recursive procedure architecture); control flow scope (repeat N [...]/forever [...]/while/do loops; if/ifelse/test/iftrue/iffalse branching; catch/throw non-local exit); list operation scope (first/last/butfirst/butlast/fput/lput/list/sentence; database add/remove/present/foreach); Logo variant scope (UCBLogo, NetLogo, StarLogo, LogoWriter; variant API differences; porting); and hour logging format (procedure name; operation type; before/after metric; Logo variant).

How should Logo developer retainer hours be logged?

Log each Logo retainer session with: advisory category (savestate/restorestate heading-state design; wrap/window/fence boundary mode; to procname :param ... end procedure authorship; output vs stop return; local/make variable binding; repeat N [...]/forever [...]/while loop design; if/ifelse/test/iftrue/iffalse branching; first/last/butfirst/butlast selector; fput/lput/list/sentence construction; database add/remove/present/foreach; UCBLogo/NetLogo/StarLogo/LogoWriter variant API), the specific procedure name and the heading-state or list construction problem (recursive tree procedure restoring position but not heading; 8 wrong tree shapes/day; added heading save/restore; wrong shapes: 8/day → 0), and the before/after metric (wrong tree shapes/day: 8 → 0; premature loop terminations/session: 5 → 0; reversed list outputs/day: 4 → 0). Include Logo variant, OS, and whether the fix required heading-state addition, loop restructuring, list-construction correction, or recursive procedure redesign.