## logo

### Introduction

This Scheme code is a small but serious implementation of Logo. It is inspired by Brian Harvey's UCB Logo. No attempt at optimization has been made. There are many optimizations that are easily made; however, the implementation is not properly tail recursive and adding that optimization would be non-trivial. In general, making a dynamically scoped language properly tail recursive is tricky, and even experts have goofed. See Darius Bacon's note for a discussion of how to implement both dynamic scope and proper tail recursion.

While the syntax and semantics are very similar to UCB Logo, there are some small differences. For example, no line continuation indicators are necessary; carriage returns can be used to format the input. To cause the input to be evaluated, press return on a blank line. Also, the infix operations are not self delimiting. Thus `2+3` does not evaluate to a number. Finally, there is no special mode for entering procedures. They can be typed in on one line or many using either the `To` special form or the `Define` command.

### Usage:

[procedure] (go-logo)

Starts an interactive Logo session.

### Sample Interaction

Welcome to Arthur Nunes-Harwitt's Classic Logo ?to downup :word print :word if equalp count :word 1 [stop] downup bl :word print :word end ?downup "Hello Hello Hell Hel He H He Hel Hell Hello ?print 2+3i + 4 6+3i ?print count "Hello 5 ?to fact :n if :n = 0 [op 1] op :n * fact :n - 1 end ?print fact 5 120 ?to fib :n if :n < 2 [op 1] op (fib :n - 1) + (fib :n - 2) end ?print fib 4 5 ?print fib 5 8 ?print fib 6 13 ?make "x 0 ?print :x 0 ?repeat 720 [make "x :x + 1] ?print :x 720

### Defined Logo Primitives

#### Math

Sum | Difference | Minus | Product | Quotient |

Power | Remainder | Int | Round | Abs |

Sqrt | Exp | ln | Log10 | Sin |

Cos | ArcTan | RadSin | RadCos | RadArcTan |

Float | Numerator | Denominator | RealPart | ImagPart |

#### Infix

< | = | > | + |

- | * | / | ^ |

#### Predicates

GreaterP | LessP | EqualP | IntegerP |

FloatP | RatioP | ComplexP | ListP |

WordP | NumberP | EmptyP | MemberP |

ProcedureP | PrimitiveP | DefinedP | NameP |

#### Logical Connectives

Not | And | Or |

#### Symbolic Processing

First | Butfirst | BF | Fput |

Sentence | SE | List | Last |

Butlast | BL | Lput | Count |

Item | Ascii | Char | Word |

#### Control

If | IfElse | Repeat |

Output | OP | Stop |

Catch | Throw | Run |

#### State

Make | Define | Text |

#### I/O

Show | Type | Readlist | RL |

#### Property Lists

GProp | RemProp | PProp | PList |

#### Special Form

To *name* *var** *command** end

### Author

Arthur Nunes-Harwitt

### License

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/2.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.