FACTOID # 18: Alaska spends more money per capita on elementary and secondary education than any other state.
 Home   Encyclopedia   Statistics   States A-Z   Flags   Maps   FAQ   About 


FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:



(* = Graphable)



Encyclopedia > Logo programming language
Logo turtle graphic

The Logo programming language is a functional programming language. It is an easier to read adaptation by Wally Feurzeig and Seymour Papert of the Lisp programming language; some have called it Lisp without the parentheses. Today, it is known mainly for its "turtle graphics", but it also has significant facilities for handling lists, files, and I/O. Logo can be used to teach most computer science concepts, as UC Berkeley Lecturer Brian Harvey does in his "Computer Science Logo Style" trilogy. There are also many object oriented dialects of Logo. Image File history File links Remi_turtlegrafik. ... Image File history File links Remi_turtlegrafik. ... Functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions. ... Wally Feurzeig is an inventor of the LOGO programming language, and a well-known researcher in Artificial Intelligence. ... Seymour Papert Seymour Papert (born March 1, 1928 Pretoria, South Africa) is an MIT mathematician, computer scientist, and prominent educator. ... Lisp is a family of computer programming languages with a long history and a distinctive fully-parenthesized syntax. ... The University of California, Berkeley (also known as Cal, UC Berkeley, UCB, or simply Berkeley) is a prestigious, public, coeducational university situated in the foothills of Berkeley, California to the east of San Francisco Bay, overlooking the Golden Gate and its bridge. ...


History of Logo

Logo was created in 1967 at BBN, a Cambridge research firm, by Wally Feurzeig and Seymour Papert[1]. Its intellectual roots are in artificial intelligence, mathematical logic and developmental psychology. The first four years of Logo research, development and teaching work was done at BBN. The first implementation was written in LISP on a PDP-1. Its name was "ghost". The goal was basic problem solving; the turtle gave immediate (non-written) feedback so bugs could be spotted. Lots of other effects have been proposed as causes. Power was not a significant factor in the design. However, ease of use for non-typists who had to use a Teletype, was a big consideration, plus informative error comments. 1967 (MCMLXVII) was a common year starting on Sunday of the Gregorian calendar (the link is to a full 1967 calendar). ... BBN Technologies (originally Bolt Beranek and Newman) is a high technology company that provides research and development services. ... Cambridge City Hall Settled: 1630 â€“ Incorporated: 1636 Zip Code(s): 02139 â€“ Area Code(s): 617 / 857 Official website: http://www. ... Wally Feurzeig is an inventor of the LOGO programming language, and a well-known researcher in Artificial Intelligence. ... Seymour Papert Seymour Papert (born March 1, 1928 Pretoria, South Africa) is an MIT mathematician, computer scientist, and prominent educator. ... A lisp is a speech impediment, historically also known as sigmatism. ... The PDP-1 (Programmed Data Processor-1) was the first computer in Digital Equipments PDP series and was first produced in 1960. ... Logo turtle graphic The Logo programming language is a functional programming language. ... A teleprinter (teletypewriter, teletype or TTY) is a now largely obsolete electro-mechanical typewriter which can be used to communicate typed messages from point to point through a simple electrical communications channel, often just a pair of wires. ...

The turtle was a rather late innovation. Logo is not too much different now from the basic concepts before the first turtle. The first turtle was a radio controlled (wireless) floor roamer named "Irving". Irving had touch sensors and could do forward, back, right, left (rotations), and ding (Irving had a bell). The earliest school users were at Muzzy Jr High, Lexington MA. Settled: 1640 â€“ Incorporated: 1713 Zip Code(s): 02420 / 02421 â€“ Area Code(s): 339 / 781 Official website: http://ci. ...

Implementations of Logo

There are over 130 implementations of Logo, each of which has its own strengths. A popular cross-platform implementation is UCBLogo. MSWLogo (and its successor FMSLogo), its freeware Windows derivative, is commonly used in schools in the United Kingdom. Comenius Logo is available in Dutch, German, Czech etc. SOLI Logo was a French version widely used in primary schools in the 1980s. In 1984, ExperLogo for the Macintosh added turtles in 3D and on the surface of spheres. It was also compiled instead of interpreted and hence was very fast. Lego/Logo was a system for controlling the turtle or Lego motors and sensors, and was often used in the classroom in the mid 90's. ARLOGO is an Arabic Port of UCBLOGO, considered the first open-source programming language in Arabic. ARLOGO is the Arabic language Logo Project. ...

A modern derivative of Logo is a variation that allows thousands of "turtles", each moving independently. There are two popular implementations: MIT StarLogo and NetLogo. These derivatives allow for the exploration of emergent phenomena and come with many experiments in social studies, biology, physics, and many other sciences. Although the focus is on the interactions of a large number of independent agents, these variations still capture the original flavor of Logo. StarLogo is an agent-based simulation language developed at MIT Teacher Education Program. ... NetLogo is a multi-agent modeling language and integrated modeling environment. ... A termite cathedral mound produced by a termite colony: a classic example of emergence in nature. ... Simple reflex agent Learning agent In computer science, an intelligent agent (IA) is a software agent that exhibits some form of artificial intelligence. ...

There is no single agreed-upon Logo language definition or standard, only a loose tradition. As a result, there are substantial differences between the many dialects of Logo that have evolved. The code examples shown below would work in many Logo dialects, but not all.

Logo programming

The idea is that a turtle with a pen strapped to it can be instructed to do simple things like move forward 100 spaces or turn around. From these building blocks you can build more complex shapes like squares, triangles, circles--using these to draw houses or sailboats.

The turtle moves with commands that are relative to its own position, "LEFT 90" meant rotate left by 90 degrees. A student could understand (and predict and reason about) the turtle's motion by imagining what they would do if they were the turtle. Papert called this "body syntonic" reasoning.

The idea of turtle graphics is also useful for example in Lindenmayer system for generating fractals. An L-system or Lindenmayer system is a formal grammar (a set of rules and symbols) most famously used to model the growth processes of plant development, though able to model the morphology of a variety of organisms. ...

Turtle programming

The following are examples of Turtle code. While seemingly very simple, turtles can be given groups of instructions, essentially creating libraries of more complex commands. In practice short forms are used. For example, "LEFT 90" is written "LT 90". Key words are usually written in upper case for beginners, but more advanced texts use lower case.

Example 1: a square


Basic Square
This would draw a square with sides 100 units long (but the turtle still has to turn LT 90 to be in the starting position). Logo Example Ex1 Square This is a screenshot of a copyrighted website, video game graphic, computer program graphic, television broadcast, or film. ...

Example 2: a triangle

The commands may be written on one line, or more.

 repeat 3[fd 100 rt 120] end 

Example 3: dotted line

The turtle's pen could be lifted and lowered; drawing a dotted line was rudimentary. In this example we'll use the short form for FORWARD, which is FD. (A typical command can then be read "FD space 10", specifying everything clearly and saving frustration.) Anything written after the ; (semicolon) is ignored, allowing the coder to insert comments.

 FD 20;(drawing a line and moving) PENUP ;(now we've lifted the pen so it won't draw anything even if we do move) FD 20 ;(not drawing but moving) PENDOWN ;(now we've lowered the pen so it draws a line wherever the turtle moves) FD 20;(drawing a line and moving) PENUP FD 20;(etc...) PENDOWN FD 20 

Dotted Line
Logo Example Ex3 Dotted Line This is a screenshot of a copyrighted website, video game graphic, computer program graphic, television broadcast, or film. ...

Example 4: loops

You could also use loop (repeat) commands. This would draw the exact same box as in the first example:

  REPEAT 4 [FD 100 RIGHT 90]  

Which would execute the command "FD 100 RIGHT 90" four times. A simplistic circle consists of 360 individual rotations with a step forward, so "REPEAT 360 [FD 1 RIGHT 1]" would have the expected result.

Example 5: new words

You can teach the turtle new words, i.e. groups of instructions, or procedures. This can be done from the Logo prompt or an Editor, which is invoked by EDALL in many Logo dialects. The commands TO CHAIR and END must be entered on separate lines.


Basic Chair
Logo Example Ex5 Chair This is a screenshot of a copyrighted website, video game graphic, computer program graphic, television broadcast, or film. ...

Once one is finished with the editor, it must be exited. The new word is saved into the available vocabulary, but the definition will be lost once the Logo interpreter is stopped. In this case, any time CHAIR is entered, "REPEAT 4 [FD 100 LEFT 90] FD 200" will be executed. CHAIR can be used as a command; for example, REPEAT 4 [CHAIR] would compound the CHAIR operation four times.

Example 6: erasing (in the UCBLogo dialect)

The turtle can erase a line, using the command PENERASE (PE). The pen can be restored with the command PENPAINT (PPT).

 EDALL ;(to enter the editor mode, then the actual procedure)  TO ERASECHAIR PE BK 200 REPEAT 4 [FD 100 RT 90] PPT END  

This example introduces two new instructions, which are best taught by running them through a Logo interpreter and observing the result. This typifies the general spirit of Logo.

Example 7: parameters: giving the word changeable information

Logo can pass extra information to its words, and return information. We must tell the word to expect something and give it a name. Notice the use of the colon. We are passing 'by value' and the colon is pronounced as 'the value of'. When the procedure is run with a command like CHAIR 200, the size takes the value 200 so we go 'FD the value of 200'.

 EDALL ;(to enter the editor mode, then the actual procedure) TO CHAIR :thesize REPEAT 4 [FD :thesize RT 90] FD :thesize FD :thesize END 


 CS REPEAT 9 [CHAIR 50 RT 20 CHAIR 100 WAIT 50 RT 20] 

Logo Example Ex7 Pattern This is a screenshot of a copyrighted website, video game graphic, computer program graphic, television broadcast, or film. ...

If you do need help, type HELP, or HELP "HOME (note the single quote mark.)

The language

Logo is generally known as an interpreted language, although recently there have been developed compiled Logo dialects - like ELICA. Logo is not case dependent, but retains the case used for formatting. It is written in lines. It is a compromise between a sequential programming language with block structures, and a functional programming language. There is no 'standard' LOGO, but UCBLogo is highly regarded. It is a teaching language but its list handling facilities make it remarkably useful for producing useful scripts.

Functions and procedures

Each line is made up of "function calls", of which there are two types:

  • commands (which do something—effects—but don't return a value) like print.
  • operations (which just return a value, its output) like sum, first or readlist.

A command is similar to a Pascal procedure, and an operation is similar to a Pascal function. A special subset of operations, called predicates, which just output the word true or false, are conventionally written with a final p. Examples include emptyp, wordp, and listp. Pascal is an imperative computer programming language, developed in 1970 by Niklaus Wirth as a language particularly suitable for structured programming. ...

  • Expressions can be primitives, or can be defined by the user.
  • Expressions can take zero, one or more parameters.

Mathematics in Logo uses prefix notation, like: sum :x :y, product :x :y, difference :x :y, quotient :x :y. Infix is also available.

 help "keyword ;(will bring up a full description of the expression). 

Logo allows for recursion, the process where a procedure calls itself. A Sierpinski triangle —a confined recursion of triangles to form a geometric lattice. ...

Example 8: A spiral drawn using recursion

 to spiral :size if :size > 30 [stop] ; a condition stop fd :size rt 15 ; many lines of action spiral :size *1.02 ; the tailend recursive call end 
 spiral 10 

Recursive Spiral
Logo Example Ex8 Spiral This is a screenshot of a copyrighted website, video game graphic, computer program graphic, television broadcast, or film. ...


There are three datatypes in UCBLogo,

  • the word,
  • the list,
  • the array.

A number is a special case of word.

There is no static typing. The interpreter detects the datatype by context.

There are two important symbols

  • The colon :- this means 'the contents of'

This is an extremely useful symbol that keeps reminding students that a variable is really some 'place' in memory.

  • The quote- this means '"the word is evaluated as itself"', or '"its value after evaluation is the same as it was before"'. This is important.

A number is a special case of self evaluation- it really could be written with a quote 2 is really "2

Assignment in Pascal x:= y +3 becomes in Logo

 make "x sum :y 3 


 make "x sum :y "3 

make takes 2 parameters, the second of which here is sum :y "3. Now sum takes two 'parameters' and is an 'operation', thus the calculation is possible. "3 evaluates to 3, and :y takes the contents of the thing called y, these are summed giving a number. The effect of make is to place the result into the first parameter.

An alternative way of looking at this, maybe, is that the second parameter is 'passed by value' while the first is 'passed by address.'

Indirection (within a procedure) is possible with the form make :x :x + 1.


Variables don’t have to be declared before use. Their scope is then global. A variable may be declared local, then its scope is limited to that procedure and its subprocedures (a.k.a. dynamic scope). Calling a 'procedure' with 'inputs', creates 'local variables' which hold the contents of the parameters. In computer programming in general, a scope is an enclosing context. ...


Discussing lists comes as a surprise to a Pascal programmer, who has managed quite well without them, however this opens many new possibilities. Arrays are also provided for the timid.

  • Operators exist to convert words into lists, and lists into arrays and back again.
  • This data type has the advantage over arrays that it is infinitely expandable. Data are extracted using the operations first, butfirst, last, butlast, butmember, member and item. Data elements are added using sentence fput and lput.
  • A list can be considered to be a queue with the operators queue and dequeue, or a stack with the operations push and pop.
  • Recursion rather than iteration is the natural method to process lists.

Example 9: using list primitives to extract the first five members of a list

One way would be to use iteration.

 to firstfive :alist ifelse lessp count :alist 6 [ op :alist ][make "olist []] repeat 5 [ make "olist lput first :alist :olist make "alist bf :alist ] output :olist end show firstfive [1 2 3 4 5 6 7 8 9 ] [1 2 3 4 5] foreach firstfive [1 2 3 4 5 6 7 8 9 ] show 10 - ? [9 8 7 6 5] 

Another, more elegant way would be

 to firstn :num :list if :num = 0 [output []] output fput (first :list) (firstn :num-1 butfirst :list) end to firstfive :list output firstn 5 :list end 

This method uses recursion, and is an example of a 'functional' rather than an 'imperative' programming approach.

Control structure commands

The standard Pascal controls are available, there is selection

  • ifelse test [ do_if_true list ] [do_if_false list]

There are iteration commands

  • while condition [instruction list]
  • until condition [instruction list ]
  • repeat number [instruction list]

Recursion is Logo's preferred processing paradigm.

Template iteration

The Pascal programmer will be surprised by a series of list based control structures. The basic idea is that you have two lists

 OPERATION [ a list of commands ] [ many data items ] 

each of the commands is applied in turn to each of the data items. There are several of these template commands with names like MAP, APPLY, FILTER, FOREACH, REDUCE and CASCADE. They repesent four flavours of template iteration, known as explicit-slot, named-procedure, named-slot (or Lambda) and procedure-text.

 show map [? * ? ] [ 5 6 7 ] [25 36 49 ] show filter [ (count ?) > 4 ] [ the quick brown fox jumps over the lazy dog ] [quick brown jumps] show foreach [1 2 3 4 5] [ ? * 10 ] [10 20 30 40 50] 
 RUN [ list of commands ] ;run a list of commands (or programs) from in a program. 

Property Lists

A property list is a special list where the odd number items are property name, and the even are property values. There are three commands to process property list.

 pprop :listname :name :value ;to add a new pair to the list remprop :listname :name :value ;to remove a pair to the list show gprop :listname :name ;to get the matching value from the list 

I/O Commands

Text may be written to the command window (output stream) using print, show and to the graphics window using label

The standard commands are readlist readword readchar with the normal input stream being the keyboard. In Unix tradition the input stream can be changed, so input can come from a disk file. Similarly, output can be redirected. The technique will be familiar to Pascal Programmers- using a sequence

 openread [filename] setread[filename] setreadpos nn readchar setread[] close [filename]. 

There are equivalent commands to change the output stream, openwrite, openappend, setwrite, setwritepos nn.

 dribble [filename] 

Creates a transcript of everything that is typed in or outputted to the command window.


This turns it off.


Turtle graphics is a powerful method of introducing thinking but LOGO also has a few useful Cartesian commands Cartesian means relating to the French mathematician and philosopher Descartes, who, among other things, worked to merge algebra and Euclidean geometry. ...

 home ;returns the turtle to (0,0) setx xx sety yy ; sends the turtle, still drawing to (xx,yy) seth nn ; sets the turtle on a heading or compass bearing of (nn) 

Example 10: calculating and drawing a sundial for a given latitude

This is a typical garden dial. The graphic can be printed and transferred to wood or brass to make an accurate garden timepiece. Wall sundial Wall sundial in Warsaws Old Town A sundial measures time by the position of the sun. ...

 to dial cs show [Type in your latitude as a whole number] make "latitude readword ;uses keyboard input for [i 0 6 1][ make "ang arctan product sin :latitude tan product :i 15 ;the calculation rt :ang fd 200 bk 200 lt :ang ;draw the morning line lt :ang fd 200 bk 200 rt :ang ;use symmetry to draw the afternoon line ] pu setx -300 sety -300 seth 90 pd ;send the turtle to the bottom fd 300 seth 270 rt 90 - :latitude fd 300 ;draw the [[style]] or [[gnomon]] pu home pd ;tidy it up end 

A sundial plate must be calculated for its latitude using the formula

 x= arctan( sin(latitude)*tan(HourDiff * 15) ) 

The Gnomon Angle = latitude.
Sundial in Berkeley, California
This dial is set for 38N, the latitude of Berkeley, California- the home of UCBLogo. A small correction should be made for Longitude. Logo Example Ex10 Sundial 38N This is a screenshot of a copyrighted website, video game graphic, computer program graphic, television broadcast, or film. ...

MSWLogo extensions

MSWLogo supports multiple turtles, and 3D Graphics. MSWLogo allows input from COM ports and LPT ports and also 'hardware' ports. MSWLogo also supports a windows interface thus I/O is available through this GUI- and keyboard and mouse events can trigger interrupts.

Hello World

Hello world program A hello world program is a software program that prints out Hello, world! on a display device. ...

 TO HELLO PRINT [Hello, world!] END 


  • Computer Science Logo Style, Brian Harvey, MIT Press (3 volumes) ISBN 0-262-58148-5, ISBN 0-262-58149-3, ISBN 0-262-58150-7. Available online
  • The Great Logo Adventure, Jim Muller, Doone Publications ISBN 0-9651934-6-2
  • Turtle Geometry Abelson and diSessa

External links

  • MicroWorlds EX & MicroWorlds EX Robotics: MicroWorlds is a popular modern multimedia version of Logo for the Mac and PC. It can also control LEGO and Cricket robots and is used by students around the world in several languages.
  • Berkeley Logo (UCBLogo)
  • Elica To download Elica, a 3D implementation with over 450 logo programs included
  • Gary Stager's Logo Resources: A collection of Logo resources, tips, tricks and articles by Gary Stager.
  • Logo Foundation: A group devoted to informing people about Logo and supporting them in their use of the language
  • MSWLogo: To download MSWLogo.
  • Comenius Logo A popular European Logo from Comenius University.
  • rLogo: Play with a turtle online (you will need a Java-enabled browser). This only implements graphics.
  • MIT StarLogo Logo with more than one turtle for simulating complex self-organizing systems.
  • NetLogo Free, Java-based, multi-agent Logo for learners and scientists
  • Computer Science Logo Style The complete text of Brian Harvey's 3 volume classic in PDF and other formats.
  • How to Think Like a Computer Scientist Logo version
  • Learning Logo Lessons for young people (using MSWLogo)
  • Logo project memos List of the original Logo memos from 1971-1981
  • iKnowthat.com "Botz" Botz a web based Logo-like application. Program your bot to draw, solve puzzles, and even battle other bots. Can also save your bots online and email them to others or challenge others to a battle.
  • Imagine Logo Imagine Logo, a modern SuperLogo successor, featuring use of multimedia, better object support and networking
  • AI2LOGO, written at Edinburgh University in the early 70's, used in an experimental program to teach children in the neighboring high school. (Written in Edinburgh IMP, recently reformatted and syntax colored for HTML). The lecture notes for Edinburgh University's early AI course were published in book form. Here are some sample pages from TO ARTIFICIAL 'INTELLIGENCE (1976) where LOGO is used to solve logic problems.
  • AdaLogo a gentle introduction to the programming language Ada (in German)
  • Terrapin Logo - a commercial Logo system (and optional hardware) for education
  • ACSLogo - a Logo Interpreter for Mac OS X
  • Liogo - an open source Logo Compiler for .NET and Mono
  • [2] - a free Logo compiler suported by quite a large group on Yahoo.

  Results from FactBites:
Programming Languages Directory | LOGO Programming Language (409 words)
Logo was developed by a team from MIT, Logo was originally designed to introduce children to programming concepts, to develop better thinking skills that could be transferred to other contexts.
Logo was supposed to be a language for the teaching of mathe matical ideas to children through computer programming.
Logo and language can be taught in small increments, beginning with concrete and graphic things, and can progress to words and more abstract concepts.
The Logo Programming Language (677 words)
Logo programs are usually collections of small procedures.
Programming in Logo is done by adding to its vocabulary, teaching it new words in terms of words it already knows.
Many programming languages are pretty strict about wanting to know exactly what kind of data you claim to be using.
  More results at FactBites »



Share your thoughts, questions and commentary here
Your name
Your comments

Want to know more?
Search encyclopedia, statistics and forums:


Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms, 1022, m