categories: mathematics – words and lists – tables – grammar – movement and vectors – shapes and graphics – text – conditionals and flow – booleans – containers – environment – input and output – control – sound and music – turtles
input (multiple parameters indicated by the pipe | symbol)
output
This is the description of an example primitive entry.
example usage
control
primitivename
none
@ allows you to run the built-in primitive of the given primitivename, when there is a user-defined procedure with that name typically overriding it. See runprimitive
@forward 20
containers
none
none
A colon : indicates a container, with the name of the word following the colon. turtleSpaces ‘resolves’ a :container ‘tag’ into the value of that container when an instruction is executed, such that if the value of :container is 5, then forward :container becomes ‘resolved’ to forward 5, before the instruction is executed.
show :container
words and lists
none
none
A word is an atomic word of characters. Words can be declared in two ways: either by prefacing them with a double quote ” as in “word, which does not allow spaces in the word, as the space would break the word, or with pipes as in |long word|, which can contain spaces within them. Keep in mind that a long word is treated as an atomic (single) word, and as such if you attempt to use list primitives on a long word they will not work the way you might expect, as they will only see one item.
print "word
print |long word|
mathematics
none
none
A number is any element where all the items are a number (which can include a decimal point .) such as 123 or 413.21. Numbers can be stored in containers, for example: put 5 in :container
show 214.32
containers
expression | expression
none
Assigns the value of the second expression to the container name resolved by the first expression. See make for more details
So, for example, "frog := 5 puts the value 5 in the container named frog. However, :frog := 5 puts the value of 5 in the container named whatever is inside the container named frog.
"frog := "duck
:frog = 5
show :duck
5
mathematics
number | number
number
Adds two numbers or numerical results of other primitives. Can be placed before or between the two items to be added. Similar to sum
print 3 + 4 print + 3 4
make "container xpos + ypos
mathematics
number | number
number
Subtracts two numbers or numerical results of other primitives. Similar to difference
print 5 - 4
1
mathematics
number | number
number
Multiplies two numbers or numerical results of other primitives. Similar to product
print 6 * 3
18
mathematics
number | number
number
Divides two numbers or numerical results of other primitives. Similar to quotient
print 12 / 4
3
mathematics
number | number
number
Returns the first number to the power of the second number. Similar to power
show 5 ^ 3
125
mathematics
number | number
number
Returns the remainder from dividing the first number by the second number. Similar to remainder
show 10 % 4
2
booleans
number | number
boolean
Approximate. Similar to round (number) = round (number) – returns true if the rounded inputs are equal. Similar to approximate
show 5.4 ~ 4.7
TRUE
conditionals and flow
expression = expression
boolean
Returns 1 (true) if expression1 equals (has the same result) as expression2. May be placed before or between the two expressions to be compared. If the expression is complex (is a chain of primitives, procedures or mathematical operations), it needs to be surrounded by brackets (). See equalp
if expression1 = expression2 [print [These are the same!]]
if (xpos + 4) = (ypos - 13) [...]
print = 1 2
0
conditionals and flow
expression > expression
boolean
Returns 1 (true) if expression1 is greater than expression2. Symbols may be placed before or between the two expressions to be compared. If the expression is complex (is a chain of primitives, procedures or mathematical operations), it needs to be surrounded by brackets ().
if :frogs > 0 [print "ribbit]
conditionals and flow
expression < expression
boolean
Returns 1 (true) if expression1 is less than expression2. Symbols may be placed before or between the two expressions to be compared. If the expression is complex (is a chain of primitives, procedures or mathematical operations), it needs to be surrounded by brackets ().
if :ships < 1 [gameover]
conditionals and flow
expression >= expression
boolean
Returns 1 (true) if expression1 is greater than or equal to expression2. May be placed before or between the two expressions to be compared. If the expression is complex (is a chain of primitives, procedures or mathematical operations), it needs to be surrounded by brackets ().
conditionals and flow
expression <= expression
boolean
Returns 1 (true) if expression1 is less than or equal to expression2. May be placed before or between the two expressions to be compared. If the expression is complex (is a chain of primitives, procedures or mathematical operations), it needs to be surrounded by brackets ().
conditionals and flow
expression != expression
boolean
Returns 1 (true) if expression1 is not equal to expression2. May be placed before or between the two expressions to be compared. If the expression is complex (is a chain of primitives, procedures or mathematical operations), it needs to be surrounded by brackets ().
grammar
(expressions…) (comparisons…)
none
Placed around complex expressions or comparisons to ensure proper order of processing.
if (9 + 3 / :container) > (2 * 97) [...]
grammar
[listitem1 listitem2 (listitem3…)]
list
Contains a list of items, for example requests, words or numbers. These are not
evaluated unless parsed for execution, for example in a repeat.
[forward 20 right 90]
[12 34 56 78]
[pig duck cow frog]
grammar
{listitem1 listitem2 (listitem3…)}
list
An evaluated list contains a list of words, lists and functions that are evaluated prior to processing. Useful for making a list from the results of functions, which can then be passed other functions. Note: when storing an evaluated list into a container, the list items are generated at the time the list is stored, and are static from that point onward, in contrast with runtime-evaluated expressions, which are dynamic and updated whenever the container is recalled.
make "myposition {xpos ypos zpos}
show :myposition
[0 80 0]
environment
none
word
About returns the description of the current turtleSpace. See setabout
show about
This is my turtleSpace
mathematics
number
number
Returns the absolute (non-negative) value of the input provided.
pr abs -54 54
environment
procedurename
none
Continues line-entry mode of an existing procedure.
addto "existingprocedure
sound and music
none
none
Advances (and plays) one line of a currently paused music track. You can use advancemusic to programmatically control the tempo of a song (typically inside a worker), to speed it up or slow it down as required.
advancemusic
control
time-in-milliseconds (number) | requests (list)
none
After the specified amount of time the list of requests is performed by the current turtle in a new thread.
after 1000 [print [One second has passed.]]
boolean
word1 | word2
boolean
afterp outputs true if word1 comes after word2. To make the comparison, Logo uses the ASCII codes of the characters in the words. Note that all uppercase letters come before all lowercase letters. See beforep
show afterp "bread "apple
TRUE
control
none
none
Returns the age of the current turtle in milliseconds. Reset it with resetage
show age
show snappy:age
input and output
none
list
Returns a list of all open files. See open
show allopen
turtles
none
list
Returns the turtle’s ambient light values, if the turtle is acting as a light. See setambient
show ambient
shapes and graphics
radius (number) | stacks (number) | sectors (number)
none
Creates an ‘Amiga ball’, a sphere that alternates sectors between the pen color and the fill color.
amigaball 50 10 20
shapes and graphics
radius (number) | stacks (number) | sectors (number) | ratio (number)
Creates a stretched or flattened Amiga ball, based on the supplied ratio. Respects setspheroidaxis
amigaballoid 50 10 20 0.5
movement and vectors
none
list
Returns the location of the current anchor. The anchor is the ‘pivot point’ of the orbit commands and pullin / pullout.
show anchor
conditionals and flow
comparison1 comparison2 (comparison1 comparison2 comparison3…)
boolean
Returns 1 (true) if both the provided expressions are also true 0 (false) if not.
print and 5 = 4 3 = 2
0
if and 1 = 1 2 = 2 [print [Both are true!]]
Both are true!
if (and 1=1 2=2 3=3) [print [All are true!]]
All are true!
input and output
none
word, number or list
Returns the last answer typed by the user as a response to a question. See question.
question [What is your name?]
make "username answer
shapes and graphics
“turtlea (word) | “turtleb (word)
none
Appends “turtlea’s track (its movements and graphics) to the end of “turtleb’s track. See copytrack
appendtrack "myrtle "bob
words and lists
template | inputlist
output
Runs the “template,” filling its slots with the members of “inputlist.” The number of members in “inputlist” must be an acceptable number of slots for “template.” It is illegal to apply the primitive TO as a template, but anything else is okay. APPLY outputs what “template” outputs, if anything.
print apply [[x] :x+5] [5]
10
boolean
number | number
boolean
Returns true if the rounded value of the first number is the same as the rounded value of the second number. Similar to ~. See round
show approximatep 5.4 4.8
TRUE
shapes and graphics
radius | degrees
none
Creates an arc.
arc 20 90
mathematics
number
number
Returns the inverse cosine of the provided number. The number must be between -1 and 1.
show arccos 0.2
mathematics
number
number
Returns the inverse sine of the provided number. The number must be between -1 and 1.
show arcsin 4
number
number
Returns the arctangent (inverse) of number in degrees.
print arctan 50
88.854199
words and lists
number
list
Creates a list with ’empty’ items of the given number. Once the list is created, you can replace the empty items using replace, for example
show replace 2 array 4 "frog
turtles
none
color
Returns the color of the arrow that indicates the turtle’s direction. See setarrowcolor, showarrow, hidearrow
show arrowcolor
turtles
none
distance
Returns the distance of the turtle’s directional arrow from the turtle. See setarrowdistance, showarrow, hidearrow
show arrowdistance
boolean
none
boolean
Returns true if the directional arrow is enabled. See showarrow, hidearrow
show arrowp
turtles
none
size
Returns the size of the directional arrow. See setarrowsize, showarrow, hidearrow
show arrowsize
text
character
number
Returns the ASCII (American Standard Code for Information Interchange) index value for the specified character.
print ascii "A
65
control
word or list | list
Creates new workers for each specified turtle in the word or list, and causes them to execute the instructions in the following list. Existing workers are not interrupted and as such they may conflict!
ask “myrtle [fd 20]
ask [myrtle snappy] [fd 20]
environment
procedure (word)
none
assemble turns the calling turtle’s ‘track’ (its movements and graphics) into a procedure. This is useful for turning ‘sketched out’ designs and objects into procedures for replication later. Note that the procedure created by assemble is not optimised for repetition because the track has no notion of it, so for example if you make a square using REPEAT [FD 20 RT 90], then use assemble, the assembled procedure will read FD 20 RT 90 FD 20 RT 90 etc.
assemble "mydesign
sound and music
none
none
Turns on attenuation of the calling turtle’s sound output. See setattenuation, noattenuate
attenuate
boolean
none
boolean
Returns true if the calling turtle is currently attenuating its sound.
show attenuatep
sound and music
none
number
Returns the attenuation value, which is 0.3 by default. This value affects all turtles that attenuate. See setattenutation, attenuate
show attenuation
sound and music
none
none
Causes toot, noise and playsound to ‘block’ or hold up turtle execution while they play. See noaudiowait
audiowait
boolean
none
boolean
Returns true if autowait is set on. See audiowait
show audiowaitp
input and output
none
filepath (word)
Returns the path and filename of the most recent autosave such that ‘load autosave’ will load the current project’s most recent autosave into the workspace.
load autosave
turtlesteps (number)
none
Moves the current turtle back the specified number of turtle steps.
back 20
environment
none
number
Returns the background shade. See setbackgroundshade
show backgroundshade
text
none
none
Moves the cursor one space to the left and deletes its contents.
backspace
none
none
Backtrack deletes the last entry in the current turtle’s track, that is, it undoes the last movement the current turtle made, the last turtle-specific setting that was changed (such as setpencolor) or the last object the turtle created.
backtrack
none
number
Returns the current background color.
print backgroundcolor
0
shapes and graphics
none
shade (number)
Returns the current background shade value. See setbackgroundshade
show backgroundshade
sound and music
none
none
Triggers the system beep.
beep
boolean
word1 | word2
boolean
beforep outputs true if word1 comes before word2. To make the comparison, Logo uses the ASCII codes of the characters in the words. Note that all uppercase letters come before all lowercase letters. See afterp
show beforep "bread "apple
FALSE
shapes and graphics
name (word)
none
Begins a ‘tag’, that is a grouping of movements, turtle parameter changes and shapes present in the calling turtle’s ‘track’, or output. The tag is closed with endtag. These tagged groups can be used for creating turtle models using newmodel, can be hidden or shown using hidetag or showtag, or copied using copytag
begintag "newtag
shapes and graphics
name (word) | dimensions (list)
none
Creates a ‘billboard’ using the specified image and the specified list of dimensions [x y]. See sample
billboard "marquee [100 200]
environment
none
none
Turns on ‘blocks’ mode (in development, mostly broken)
blocks
boolean
none
boolean
Returns true if blocks mode is enabled.
show blocksp
shapes and graphics
size (number)
none
Creates a lined square of the specified size.
box 20
control
none
none
‘Breaks’ or exits from the current loop, for example repeat or foreach, and continues execution.
repeat 10 [print repcount if repcount = 5 [break]] print "Broken!
1
2
3
4
5
Broken!
environment
procedure or [procedures]
none
Buries the provided procedures. Certain primitives such as ERALL, ERPS, POALL, POPS, POTS EXPORT and SAVE act on everything in the workspace except for procedures that are buried
bury "proc
environment
none
none
Buries all of the procedures and container names in the workspace. See bury
buryall
containers
name or [list]
none
Buries the provided container names.
buryname "container
words and lists
word or list
word or list
Returns the provided word or list with all elements except the first. See butlast
show butfirst [dog pig cow]
[pig cow]
show butfirst "spot
pot
words and lists
word or list
word or list
Returns the provided word or list with all elements except the last. See butfirst
show butlast [dog pig cow]
[dog pig]
show butlast "spot
spo
words and lists
list
list
Returns a list containing only those elements that are not numbers.
show butnumbers [frog 12 cow 1234]
[frog cow]
words and lists
searchmask (word) | list
list
Returns the provided list minus the elements matched by the provided search mask. See search
show butsearch "*g [frog duck pig]
[duck]
boolean
button (number)
boolean
Returns true if the specified button is pressed. 0 is the left mouse button or joypad button 0, 1 is the right mouse button or joypad button 1
show buttonp 0
control
turtle (word)
turtles (list)
none
Stops all workers running in the specified turtle(s). See halt
calm "snappy
calm [snappy myrtle]
enviroment
none
none
Enables a mode whereby you can move the camera turtle in various ways using the mouse. Clicking and dragging orbits the turtle’s anchor point. Right-clicking and moving up and down or vertical scrolling up and down pulls the turtle in or out from the anchor point. Right-clicking and moving left or right or horizontal scrolling rotates the turtle left or right. See nocamcontrol
camcontrol
boolean
none
boolean
Returns true if camcontrol is enabled.
show camcontrolp
conditionals and flow
word, longword, number, boolean or list | list
none
Compares the input with the container specified by the previous switch primitive, and if true performs the contents of the list provided. See case, otherwise
case "yes [print |Welcome aboard!|]
words and lists
none
none
Makes search, sort and comparisons case insensitive. These are case sensitive by default. See nocaseinsensitive
caseinsensitive
boolean
none
boolean
Returns true if nocaseinsensitive is enabled.
show caseinsensitivep
input and output
none
none
Opens the project catalog
cat
conditionals and flow
name | list
none
Catch executes the provided list. If throw is called while the provided list is run, control returns to the first statement after the catch. If you provide “error as the name, catch catches errors instead.
catch "duck [repeat 100 [fd 20 throw "duck]] pr "quack
catch "error [repeat 100 [fd 20
movement and vectors
none
number
Returns a value if the calling turtle passes a fence or wrap threshold. caught returns 1 if the turtle hits / passes the X1 threshold provided to wrap / fence, 2 if X2, 3 if Y1, 4 if Y2, 5 if Z1, 6 if Z2. clearcaught resets it to 0.
show caught
tables
table (word) | [row column (sheet)]
value
Returns the value stored in the specified table at the specified row, column, and sheet (if provided). See putcell
show cell "table [3 4]
20
text
none
none
Centers any text output using print.
center
text
ASCII value (number)
character
Returns a character with the specified ASCII value.
show char 84
T
shapes and graphics
radius
none
Creates a lined circle at the specified radius around the turtle
circle 50
repeat 18 [circle 50 rr 10]
mathematics
number (number) | floor (number) | ceiling (number)
number
Clamp takes the inputted number, and if it is lower than the floor, or higher than the ceiling, it returns the floor or the ceiling respectively.
print clamp 10 5 20
10
print clamp 1 5 20
5
print clamp 30 5 20
20
shapes and graphics
none
none
Erases the ‘turtle track’ (graphics) belonging to the current turtle without changing its position or state. Useful when a turtle is not actually drawing graphics but is itself a graphic element (for example, in a game) to ensure that its movements don’t build up in its track and slow down execution. To use clean in this context, simply place it at the end of the turtle’s “run loop”.
clean
shapes and graphics
none
none
Cleans all turtles in the current space. See clean
cleanspace
input and output
none
none
Clears the ‘answer’ parameter, which contains the input value from the previous ‘question’. See question, answer.
clearanswer
input and output
none
none
Clears any buffered keyboard presses. See readchar, peekchar
clearchar
environment
none
none
Clears the interactive prompt’s history.
clearhistory
shapes and graphics
imagename (word)
none
Clears the specified image from memory.
clearimage "image
shapes and graphics
none
none
Clears all iamges from memory.
clearimages
shapes and graphics
modelname (word)
none
Removes the specified model from memory.
clearmodel "model
shapes and graphics
none
none
Removes all user-defined models from memory.
clearmodels
sound and music
none
none
Clears all music from memory.
clearmusic
shapes and graphics
name (word)
none
Clears the named plot. See plot
clearplot "myplot
shapes and graphics
none
none
Clears the turtle’s ‘turtle track’ and sends the turtle to its home position.
clearscreen
environment
none
none
Clears the name / value pairs (keys) out of the current sector. See zone
clearsector
sound and music
musicname (word)
none
Clears the specified song (music) from memory.
clearsong "mymusic
sound and music
soundname (word)
none
Clears the specified sound from memory.
clearsound "mysound
sound and music
none
none
Clears all user-defined sounds from memory.
clearsounds
text
none
none
Clears the text area.
cleartext
environment
none
none
Unsets the current user, sets environment to no user. See createuser
clearuser
environment
none
none
Clears (removes) all of the defined zones from the current space.
clearzones
shapes and graphics
sourcetagname (word) | copytagname (word)
none
Clones a turtle’s tag and puts the new copy at the end of its ‘turtle track’. See tag
clonetag "oldtag "newtag
turtles
sourceturtle (word) | destinationturtle (word)
none
Clones a turtle.
cloneturtle "myrtle "max
input and output
filename (word)
none
Closes the specified file. See open
close "file
input and output
none
none
Closes all files that are currently open. See open, close
closeall
control
none
none
Continues execution if that execution was halted by the pause primitive. See pause.
co
text
color index (number)
none
Inserts a ‘color character’ into a word, which when printed changes the foreground color of the subsequent text in the word to that color. A color character cannot be a list item unto itself (it will return an error).
print word colchar 4 "duck
shapes and graphics
number
list
color returns the red, green and blue values of the specified color
show color 5
[128 128 128]
show color brown
[128 80 0]
shapes and graphics
none
list
Returns a list of lists containing all of the colors’ RGB values in order of color index, eg with the first list being [0 0 0] (black) and the 16th list being white [255 255 255]. For an easier-to-read version, see listcolors
show colors
tables
table (word) | column (number)
list
Returns the contents of the specified column in the specified table as a list. See row
show column "table 5
shapes and graphics
radius (number) | depth (number) | sides (number)
Creates a cone pointing downward from and centered on the calling turtle.
cone 20 10 20
shapes and graphics
radius (number) | depth (number) | sidestotal (number) | sidesused (number)
none
Creates a sliced cone.
coneslice 20 20 20 10
shapes and graphics
radius (number) | depth (number) | sides (number) | ratio (number)
Creates a conoid, a cone stretched or compressed based on the provided ratio (1 is normal, 2 is stretched twice as much, 0.5 half as much, etc.)
conoid 20 40 20 2
shapes and graphics
radius (number) | depth (number) | sidestotal (number) | sidesused (number) | ratio (number)
none
Creates a sliced conoid.
conoidslice 20 20 20 10 2
boolean
word
boolean
Returns true if the first letter of the supplied word is a consonant. Y is considered a vowel. See vowelp
show consonantp "x
TRUE
words and lists
word or list | list
Returns the index of the first list item matched by the provided word or list. See containsp
show contains “frog [duck frog pig]
2
boolean
word or list | list
boolean
Returns true if the specified word exists as an item in the specified list. See contains
show containsp "frog [pig duck frog]
true
control
turtle (word) | primitives (list)
none
Executes the specified primitives using the specified turtle in the thread that calls the control primitive. Same as executing turtle:run [do these things], but easier to automate, for example: foreach “turtle everyone [control :turtle [fd 10]]
control "snappy [orbitleft 20]
turtles
sourceprocedure (word) | procedurecopy (word)
none
Copies a procedure inside a turtle to a procedure with the provided name
copydef "procedure "procedurecopy
input and output
source (word) | destination (word)
Copies the specified file to the specified destination.
copyfile “myfile “myfile2
turtles
procedure (word) | target (word)
none
Copies a procedure from the calling turtle to the target turtle
copyproc "procedure "turtle
shapes and graphics
tag (word) | turtle (word)
none
Copies a tag from the calling turtle to the named turtle, at the end of the named turtle’s turtle track.
copytag "tag "turtle
shapes and graphics
“turtlea (word) | “turtleb (word)
none
Copies “turtlea’s track (its movements and graphics) to “turtleb, overwriting “turtleb’s existing track. See appendtrack
copytrack "myrtle "bob
mathematics
input (number)
output (output)
Returns the cosine of the input. See sin
show cos 120
-0.50000077735
words and lists
word or list
number
Returns the number of characters or items in the provided word or list, respectively.
show count "frog
4
show count [pig duck frog]
3
input and output
directory
none
Creates a new directory in the current path.
createdir "newdir
environment
name (word)
none
Creates a new user with the specified name.
createuser "Bonnie
environment
list
none
Creators contains an auto-generated list of the turtleSpace’s creators for use by the catalogue. It is metadata and cannot be retrieved by code. It should not be manually modified. See about
creators [Bonnie]
words and lists
template | list
list
outputs a list containing the results of template evaluations. Each data list contributes to a slot in the template; the number of slots is equal to the number of data list inputs. As a special case, if only one data list input is given, that list is taken as a list of data lists, and each of its members contributes values to a slot. CROSSMAP differs from MAP in that instead of taking members from the data inputs in parallel, it takes all possible combinations of members of data inputs, which need not be the same length.
show (crossmap [word ?1 ?2] [a b c] [1 2 3 4])
[a1 a2 a3 a4 b1 b2 b3 b4 c1 c2 c3 c4]
shapes and graphics
none
none
Causes all turtles to clear their turtle tracks and return to their starting positions.
csall
shapes and graphics
size
none
Creates a wireframe cube of the specified size
cube 20
shapes and graphics
width | height | depth
none
Creates a wireframe cuboid of the specified dimensions
cuboid 30 20 10
text
none
none
Returns the position of the text cursor.
show cursor
text
none
none
Moves the text cursor down one.
cursordown
text
none
none
Returns the cursor to the left side of the text area.
cursorhone
text
none
none
Moves the text cursor one to the left.
cursorleft
text
none
none
Moves the text cursor one to the right.
cursorright
text
none
none
Moves the text cursor up one.
cursorup
shapes and graphics
radiusnear (number) | radiusfar (number) | depth (number) | sides (number)
none
Creates a truncated, or cut, cone. See cone
cutcone 10 20 30 30
shapes and graphics
radiusnear (number) | radiusfar (number) | depth (number) | sidestotal (number) | sidesused (number)
none
Creats a cut, sliced cone. See coneslice
cutconeslice 20 40 20 20 10
shapes and graphics
radiusnear (number) | radiusfar (number) | depth (number) | sides (number) | ratio (number)
none
Creates a truncated, or cut, conoid, stretched based on the provided ratio. See conoid
cutconoid 10 20 30 30 2###
shapes and graphics
radiusnear (number) | radiusfar (number) | depth (number) | sidestotal (number) | sidesused (number) | ratio (number)
none
Creates a cut, sliced conoid, stretched based on the provided ratio. See conoid
cutconoidslice 10 20 30 30 15 2
shapes and graphics
radiusnear (number) | radiusfar (number) | depth (number) | sides (number)
none
Creates a cut funnel (an uncapped cut cone).
cutfunnel 20 10 20 20
shapes and graphics
radiusnear (number) | radiusfar (number) | depth (number) | sides (number) | ratio (number)
none
Creates a cut funneloid (an uncapped cut conoid).
cutfunneloid 20 30 20 20 0.5
shapes and graphics
radiusnear (number) | radiusfar (number) | depth (number) | sidestotal (number) | sidesused (number) | ratio (number)
none
Creates a cut, sliced funneloid (an uncapped cut conoid).
cutfunneloidslice 20 30 20 20 10 0.5
shapes and graphics
radiusnear (number) | radiusfar (number) | depth (number) | sidestotal (number) | sidesused (number)
none
Creates a sliced, cut funnel (an uncapped cut cone).
cutfunnelslice 20 10 20 20 10
shapes and graphics
radius (number) | stacks (number) | sectors (number) | minstack (number) | maxstack (number)
none
Creates a truncated, or cut, sphere. Can be cut on the top, bottom, or both based on specified minstack and maxstack values. See sphere
cutsphere 30 14 32 4 13
shapes and graphics
radius (number) | stacks (number) | totalsectors (number) | minstack (number) | maxstack (number) | usedsectors (number)
none
Creates a sliced and cut sphere. Can be cut on the top, bottom, or both based on specified minstack and maxstack values. Displays the portion specified by totalsectors and usedsectors. See sphereslice, cutsphere
cutsphereslice 30 20 20 5 15 10
shapes and graphics
radius (number) | stacks (number) | sectors (number) | minstack (number) | maxstack (number) | ratio (number)
none
Creates a truncated, or cut, sphere, stretched by the provided ratio. Can be cut on the top, bottom, or both based on specified minstack and maxstack values. See spheroid
cutspheroid 30 14 32 4 13 0.5
shapes and graphics
radius (number) | stacks (number) | totalsectors (number) | minstack (number) | maxstack (number) | usedsectors (number) | ratio (number)
none
Creates a sliced and cut spheroid. Can be cut on the top, bottom, or both based on specified minstack and maxstack values. Displays the portion specified by totalsectors and usedsectors. Is stretched by the ratio provided. See spheroidslice, cutspheroid
cutspheroidslice 30 20 20 5 15 10 2
shapes and graphics
radius (number) | depth (number) | sides (number)
none
Creates a cylinder
cylinder 20 30 10
shapes and graphics
thickness (number) | radius (number) | sides (number) | totalsegments (number) | arcsegments (number)
none
Creates a partial torus, or curved cylinder.
cylinderarc 5 15 20 20 10
shapes and graphics
thickness (number) | radius (number) | sides (number) | totalsegments (number) | arcsegments (number) | startsides (number) | endsides (number)
Creates a slice of a partial torus, or curved cylinder. Note: If you invert the thickness value, you can ‘slice’ the opposite side.
cylinderarcslice 5 15 20 20 10 5 15
shapes and graphics
radius (number) | depth (number) | totalsides (number) | slicesides (number)
none
Creates a rounded wedge shape, like a slice of a round of cheese, starting at the turtle’s right vector and moving counter-clockwise.
cylinderslice 20 10 20 10
shapes and graphics
radius (number) | depth (number) | sides (number) | ratio (number)
none
Creates a cylindoid
cylindroid 20 30 10 2
shapes and graphics
thickness (number) | radius (number) | sides (number) | totalsegments (number) | arcsegments (number) | ratio (number)
none
Creates a cylinder arc extruded by the provided ratio.
cylindroidarc 5 15 20 20 10 2
shapes and graphics
thickness (number) | radius (number) | totalsides (number) | totalsegments (number) | arcsegments (number) | startsides (number) | endsides | ratio (number)
none
Creates a cylinder arc sliced by the provided sides values and extruded by the provided ratio.
cylindroidarcslice 5 15 20 20 10 10 15 2
shapes and graphics
radius (number) | depth (number) | totalsides (number) | slicesides (number) | ratio (number)
none
Creates a stretched rounded wedge shape, like a slice of a round of cheese, starting at the turtle’s right vector and moving counter-clockwise, and stretched using the provided ratio, where 1 is normal, 0.5 is half, 2 is double etc.
cylindroidslice 20 10 20 10 0.5
control
none
none
Waits until all of the turtle’s workers except for its ‘main’ one and / or hatchlings finish executing.
newworker [repeat 100 [wait 1]] dawdle print |Done waiting.|
environment
none
number
Returns the current day of the month.
show day
22
environment
none
none
Turns on debugging. Debug output is logged to the console / terminal that executes turtleSpaces, so if you need debugging you need to launch it from a console / terminal. Further, debug needs to be used as a prefix from the interactive mode prompt, eg debug myprimitive, otherwise it can be called from inside an primitive and applies to the executing thread.
debug
boolean
none
boolean
Returns true if debug is enabled.
show debugp
mathematics
word
none
Decreases the value of the specified container (variable) by one. Note that the container (variable) specified by dec begins with a quote (“) not a colon. This is so that you can pass dec a container specified inside another container. See inc
make "counter 10
dec "counter
print :counter
9
will decrement the container named counter by one.
make "fred 5
make "counter "fred
dec :counter
print :fred
4
will decrement the container specified by :counter ("fred) by one.
environment
procedurename (word) | procedure (list)
none
define creates a new procedure of the given procedurename containing the primitives described by the provided list, in the format [[:parameter1 :parameter2] [primitive1 primitive 2 primitive3…]]
define "newprocedure [[:size] [repeat 4 [fd :size rt 90]]]
shapes and graphics
index (number) | list or word
none
definecolor takes an index number from 0 to 63 and either a list of three values (representing red, green, and blue) with a value from 0 to 100, or a 6-character word representing a color’s RGB values in hexadecimal format, for example ab1274. The color palette defined by definecolor is used for pen and fill colors. For text colors see definetextcolor
definecolor 20 [50 20 90]
definecolor 21 "ab1274
boolean
procedurename (word)
boolean
Returns TRUE if the provided procedurename is the name of a defined procedure.
show definedp "myprocedure
TRUE
text
index (number) | list or word
none
definetextcolor takes an index number from 0 to 63 and either a list of three values (representing red, green, and blue) with a value from 0 to 100, or a 6-character word representing a color’s RGB values in hexadecimal format, for example ab1274
definetextcolor 20 [50 20 90]
definetextcolor 21 "ab1274
input and output
file (word)
none
Deletes the specified file from the current turtleSpace. For safety, delete can only delete files from the root of the turtleSpace.
delete "myfile
shapes and graphics
name (word)
none
Deletes the named overlay.
deleteoverlay "myrtlesview
shapes and graphics
name (word)
none
Deletes the named plot. See plot
deleteplot "myplot
shapes and graphics
name (word)
none
Deletes the sticker with the specified name. See placesticker.
deletesticker "marquee
containers
container
item
Similar to pop, except removes the item from the end of the list. See pop
show dequeue "container
control
none
none
die halts the thread that calls it. Useful for terminating execution arbitrarily, although it should be done more gracefully, where possible.
die
mathematics
number1 (number) | number2 (number)
number
Difference outputs the result of subtracting number 2 from number 1.
show difference 5 1
4
turtles
none
list
Returns a list of the diffuse light values, if the turtle is a light. See setdiffuse
show diffuse
movement and vectors
position (list)
vectors (list)
Returns a list of vectors that would point the calling turtle at the supplied list of co-ordinates.
show direction myrtle:position snappy:position
[[0 1 0] [0 0 1] [1 0 0]]
snappy:setvectors direction myrtle:position
movement and vectors
position (list) | position (list)
distance (number)
Returns the distance from the first given set of co-ordinates to the second given set of co-ordinates.
show distance myrtle:position snappy:position
show distance [0 0 0] [100 100 100]
movement and vectors
[vector1 vector2] (list) | [vector3 vector4] (list)
degrees (number)
Divergence returns the degrees of difference (divergence) between vector1 and vector3 in a clockwise direction, that direction established using vector2 and vector4, which need to be the axis you would be pivoting on to measure that difference. So if you’re measuring the degrees of difference between two forward vectors in terms of left and right, the second vector needs to be the up vector. If you were measuring the difference in terms of up and down, you would give the right vector. Divergence is extremely useful for ball games.
show divergence {item 1 myrtle:vectors item 3 myrtle:vectors} {item 1 snappy:vectors item 3 myrtle:vectors}
90
boolean
numerator (number) | denominator (number)
boolean
returns true of the numerator divides evenly into the denominator. See remainder,
show divisorp 5 20
true
shapes and graphics
size (number)
none
Creates a dodecahedron (12-sided shape) of the specified size.
dodecahedron 5
shapes and graphics
size (number) | ratio (number)
none
Creates a dodecahedroid (12-sided shape) of the specified size and stretched using the specified ratio.
dodecahedroid 5 2
dodecahedroid 10 0.5
shapes and graphics
radius (number) | stacks (number) | sectors (number)
none
Creates a dome
dome 20 10 10
shapes and graphics
radius (number) | stacks (number) | sectors (number) | stretch (number)
none
Creates a stretched dome.
domoid 20 10 10 2
shapes and graphics
modelname (word)
none
Like stamp, except creates a reference to the provided model rather than copying the model into the turtle track. This means that if the model changes, its doppel representation will also change.
doppel "myrtle
conditionals and flow
milliseconds (number) | list
none
Performs the provided list of instructions and then sleeps if and until the provided number of milliseconds has passed since the list started execution
dosleep 1000 [print "hello!]
shapes and graphics
[x y (z)] (list)
none
Puts a dot at the specified co-ordinates using the specified pen color (this is for Apple Logo compatibility). If z is not specified, z = 0. Dots are removed by clean, clearscreen. See dots, dotp, dotsize.
dot [10 10]
boolean
[x y (z)] (list)
none
Returns true if there is a dot at the specified co-ordinates. Dots are turtle-specific, and so dotp will only detect the calling turtle’s dots.
show dotp [10 20 30]
shapes and graphics
none
list
Returns a list of the co-ordinates of all the dots currently in the calling turtle’s turtle track. See dot, dotp
show dots
shapes and graphics
none
size (number)
Returns the calling turtle’s current dot size. See setdotsize, dot, dotp.
show dotsize
conditionals and flow
expression | instructions (list)
none
Repeats the provided list of instructions until the provided expression is true.
make "counter 0 dountil :counter = 5 [make "counter :counter + 1 print :counter]
1
2
3
4
5
conditionals and flow
expression | instructions (list)
none
Repeats the provided list of instructions while the provided expression is true.
make "counter 0 dowhile :counter < 5 [make "counter :counter + 1 print :counter]
1
2
3
4
5
movement and vectors
degrees (number)
none
Tilts the calling turtle’s nose down by the given number of degrees. See up
down 45
environment
none
none
Allows text to be selected and copied to the clipboard by clicking and dragging. See nodragselect
dragselect
boolean
none
boolean
Returns true if dragselect is enabled
turtles
none
none
Empties the calling turtle’s message queue.
drain
input and output
file (word)
none
Sends a copy of the characters displayed on the screen to a file. nodribble stops it. See nodribble
dribble "mydribble.txt
boolean
none
boolean
Returns true if turtleSpaces is currently dribbling. See dribble
movement and vectors
steps vector
Causes the selected turtle to ‘drift’ the specified number of steps in the direction specified by vector. You can use drift to simulate momentum or gravity, particularly in concert with workers. See forwarddir
drift 10 forwarddir
forward 10 make "forward forwarddir newworker [repeat 5 [drift 1 :forward]]
movement
none
none
Sets the selected turtle’s orbit anchor point to its current position. See setanchor
repeat 10 [penup forward 60 dropanchor pullout 50 pendown repeat 36 [orbitleft 10]]
shapes and graphics
radiusnear (number) | radiusfar (number) | depth (number) | sides (number) | ratio1 (number) | ratio2 (number)
none
Creates a cut conoid with two different oid (stretch) ratios, one for each end. See cutconoid, duocutfunneloid
duocutconoid 20 30 20 20 0.5 2
shapes and graphics
radiusnear (number) | radiusfar (number) | depth (number) | sides (number) | ratio1 (number) | ratio2 (number)
none
Creates a cut funneloid (an uncapped cut conoid) with two different oid (stretch) ratios, one for each end. See cutfunneloid
duocutfunneloid 20 30 20 20 0.5 2
shapes and graphics
radius (number) | depth (number) | sides (number) | ratio1 (number) | ratio2 (number)
none
Creates a cylindroid with two different oid (stretch) ratios, one for each end. See cylindroid, duotuboid
duocylindroid 20 20 20 0.5 2
shapes and graphics
radius (number) | depth (number) | sides (number) | ratio1 (number) | ratio2 (number)
none
Creates a tuboid, or stretched tube, with two different oid (stretch) values, one for each end. Can be used to transition between non-oids and oids, or between two oids. See tuboid
duotuboid 10 20 20 0.5 2
mathematics
none
number
Returns the constant e, which is 2.7182818284590452353
show e
environment
none
none
Opens the entire workspace in the editor. Can also be invoked with control-E. To open just one particular procedure, use edit
ed
environment
procedure (word)
none
Invokes the editor and opens specified procedure. To edit the entire workspace, use ed
edit "bananas
input and ouput
filename (word)
none
Opens the specified file for editing in the editor.
editfile "myfile
containers
containername (word)
none
Inserts a make statement into the prompt containing the specified container name and its contents for editing.
edn "container
containers
containername(s) (list)
none
Opens the editor with a list of the provided containers and their contents, which are updated when the editor is exited.
edns [container1 container2]
shapes and graphics
width (number) | height (number)
none
Creates a pen-drawn ellipse of the specified width and height.
ellipse 50 20
conditionals and flow
list
none
Executes the provided list of requests if the previous if comparison was false. else is not necessary if the list of requests immediately follows the list of requests specified for the true condition, but else allows for the requests to be executed later in the program flow.
if :container = 5 [do this] [do that]
else is not needed here, since if can take an else request list
if :container = 5 [do this]
print |I am the walrus|
else [do that]
but else can come later
words and lists
none
nothing
Returns nothing. Used to ‘reset’ a container or list item to nothing (undefined).
make "container empty
words and lists
word or list item
boolean
Returns true if the provided word or list item is empty (blank).
print emptyp "
true
environment
none
none
Closes a ’to’, a procedure definition. See to
end
shapes and graphics
none
none
Closes the currently open tag. See tag
endtag
environment
none
none
Erases all procedures, variables and properties from the workspace.
erall
environment
procedure (word)
none
Erases the specified procedure from the calling turtle’s workspace
erase "myprocedure
containers
container (word)
none
Erases the named local container. See local
erase "localcontainer
containers
container (word)
none
Erases the name off of a specified container (unallocating it), and empties its contents.
erasename "mycontainer
containers
none
none
Erases the names off of all the containers held by the turtle that calls it, and empties their contents
erasenames
environment
none
none
Erases all procs in the calling turtle. To erase all procs in all turtles see initialize
eraseprocs
containers
container (word)
none
Erases the named private container. See private
eraseprivate "privatecontainer
containers
container (word)
none
Erases the specified shared container.
eraseshare "sharedcontainer
containers
none
none
Erases all shared containers and their contents.
tables
table (word)
none
Erases the named table.
erase "mytable
shapes and graphics
tag (word)
none
Erases the named tag and its contents.
erasetag "mytag
control
name (word)
none
Erases the specified turtle
erase "fred
boolean
expression | expression
boolean
Returns true if both supplied expressions are equal
show equalp 5 5
TRUE
show equalp 3 5
FALSE
control
none
none
Allows the user to use the escape key to halt all execution. See noescape
escape
boolean
none
boolean
Returns true if escape is enabled
show escape
conditionals and flow
list
output
evaluates the expression in the supplied list and returns its output.
show eval [10 + 2]
12
boolean
number
boolean
Returns true if the provided number is even (0, 2, 4, 6…)
show evenp 6
control
none
list
Returns a list of all turtles except Snappy, which is a camera-only turtle. Useful to use with foreach to iterate through a series of instructions with each turtle.
show everyone
["myrtle]
words and lists
index1 (number) | index2 (number) | word or list
word or list
Exchanges the item at index1 in the given word or list with the item at index2.
show exchange 1 2 [pig cow]
[cow pig]
show exchange 1 5 "solar
"rolas
input and output
name (word)
none
Saves an .lgo file with the provided name containing the current turtlespace code.
export "MyCode
movement and vectors
position (list) | vector (list) | distance (number)
list
Returns a list of target co-ordinates based on the starting position, a vector and the distance in turtle-units along that vector.
show extrapolate position forwarddir 5
position (list of 3) | position (list of 3)
vector (list)
face takes two lists of co-ordinates (x, y and z) and then returns a list of vectors (list of three lists of three) which if applied to a turtle cause it to ‘face’ the second set of co-ordinates if positioned at the first set of co-ordinates.
setvectors face position [100 100 100]
movement and vectors
booleans
co-ordinates (list) | degrees (number)
boolean
returns true if a vector from the calling turtle to the supplied co-ordinates diverges less than the supplied number of degrees from the calling turtle's forward vector. See divergence
reset
snappy:show facingp myrtle:position 10
true
myrtle:show facingp snappy:position 10
false
boolean
none
zero
Returns zero (false).
show false
boolean
word
boolean
Returns true if the file specified by the given word exists.
show filep "myfile
input and output
none
[[list] [list]]
Returns a list of entries in the current directory divided into two lists: the first contains folders, the second files.
show files
fill
shapes and graphics
none
none
Currently does nothing. This is OpenGL not Photoshop!
shapes and graphics
none
number
Returns the fill color currently used by the selected turtle.
print myrtle:fillcolor
7
shapes and graphics
none
shade (number)
Returns the current fillshade value. See setfillshade
show fillshade
shapes and graphics
none
opacity (number)
Returns the current fill opacity
show opacity
words and lists
boolean function | word or list
word or list
Applies the provided boolean function to each character or list item in provided word or list.
print filter "consonantp "aardvark
rdvrk
words and lists
template [list] | inputs [list]
result
Find outputs the first constituent of the data input (the first member of a list, or the first character of a word) for which the value produced by evaluating the template with that constituent in its slot is TRUE. If there is no such constituent, the empty list is output.
In a template, the symbol ?REST represents the portion of the data input to the right of the member currently being used as the ? slot-filler. That is, if the data input is [A B C D E] and the template is being evaluated with ? replaced by B, then ?REST would be replaced by [C D E].
In a template, the symbol # represents the position in the data input of the member currently being used as the ? slot-filler. That is, if the data input is [A B C D E] and the template is being evaluated with ? replaced by B, then # would be replaced by 2.
to spellout :card
output (sentence (butlast :card) "of
(find [equalp last :card first ?]
[hearts spades diamonds clubs]))
end
print spellout "5d
5 of diamonds
print spellout "10h
10 of hearts
control
none
none
Halts all threads in all turtles. Stops the world. Can be invoked by pressing the escape key, unless noescape has been invoked.
finish
words and lists
word or list
word or list
Returns the first item or character in a list or word. See last.
print first "frog
f
print first [frog pig duck]
frog
shapes and graphics
width height
none
Creates a filled isosceles triangle with the center of its base at the root of the selected turtle and aligned with the turtle’s orientation. See iso.
fiso 20 10
movement and vectors
position
none
Both sets the anchor point and points the selected turtle at it. Compare with setanchor, which does not change the orientation of the selected turtle.
snappy:fixate myrtle:position
fixate [0 0 0]
points Snappy (the camera turtle) at Myrtle.
text
none
none
Causes subsequent text to flash. See inverse, normal.
flash
words and lists
list
list
Takes all words inside the provided list and flattens them to a single level, removing any internal hierarchy.
show flat [pig duck [cow frog [chicken sheep]]]
[pig duck cow frog chicken sheep]
turtles
none
none
Turns on ‘fluid’ mode, which causes the turtle to move incrementally. See nofluid
fluid
turtles
none
number
Returns the fluid angle. See setfluidangle
show fluidangle
boolean
none
boolean
Returns true if fluid is enabled in the calling turtle
show fluidp
turtles
none
number
Returns the fluid step value. See setfluidstep
show fluidstep
turtles
turtle (word)
none
Causes the calling turtle to ‘follow’ the specified turtle. Can only be set if the turtle is the view (camera) turtle.
follow myrtle
turtles
none
turtle (word)
Returns the name of the turtle followed by the calling turtle, if any.
show following
boolean
none
boolean
Returns true if the calling turtle is following another turtle
show followp
conditionals and flow
[container start end (optional step)] (list) | [instructions to run] (list)
none
Repeats the list of requests counting from the start value to the end value, incrementing the value of :container by one (or the optionally provided step value) each time. The value stored in container remains after the for loop has finished executing.
for [i 1 15] [print :i]
1
2
3
...
for [i 1 10 2] [print :i]
1
3
5
...
conditionals and flow
container (word) | [list of items] | [list of requests]
none
Repeats the list of requests once for each item in the list of items while also changing the value of the specified container to the list item currently being processed. Note that the container name begins with a " not a : when using foreach. Also, the value of container remains after the foreach loop has finished executing.
foreach "animal [goose horse sheep] [print {[Old Macdonald had a] :animal [E I E I O]}]
forever
list of requests
none
Repeats the list of requests until terminated by another thread or halt.
forever [print [I am slowly going crazy 1 2 3 4 5 6 switch]]
input and output
name (word)
none
Duplicates the current project and gives it the specified name, and switches to it as the currently active project. Note: If the project has a lot of files in it, this may take some time!
fork "forkedproject
words and lists
number (number) | field (number) | precision (number)
word
Form outputs the input number as a word inside the number of spaces indicated by field, with the number of digits after the decimal point indicated by precision. Spaces are added to the beginning of the word as necessary.
show form pi 10 2
3.14
movement and vectors
turtle-spaces (number)
none
Moves the turtle forward the given number of turtle steps. Draws a line if the pen is down. See pendown, back
forward 20
movement and vectors
none
vector (list)
Returns the calling turtle’s forward vector.
show forwarddir
words and lists
word | list
list
Returns the specified list with the specified word inserted in front.
show fput "cow [pig goat]
[cow pig goat]
shapes and graphics
none
none
Makes a triangle from the current position and previous two turtle positions.
forward 20 right 90 forward 20 frag
environment
none
none
Sets the graphics screen ‘fullscreen’, that is, turns off the text screen. The name of this primitive is a remnant from 8-bit computers which could only show either graphics or text in a particular area of the screen at one time. See also splitscreen textscreen overlayscreen
fullscreen
shapes and graphics
radius (number) | depth (number) | sides (number)
Creates a funnel (an uncapped cone).
funnel 20 20 20
shapes and graphics
radius (number) | depth (number) | sidestotal (number) | sidesused (number)
none
Creates a sliced funnel.
funnelslice 20 20 20 10
shapes and graphics
radius (number) | depth (number) | sides (number) | ratio (number)
Creates a funneloid (an uncapped conoid).
funneloid 20 20 20 0.5
shapes and graphics
radius (number) | depth (number) | sidestotal (number) | sidesused (number) | ratio (number)
none
Creates a sliced funneloid.
funneloidslice 20 20 20 10 2
input and output
axis
value
Returns a digital value (-1 0 1) of the specified gamepad axis. Note this only reads gamepads, not the mouse. For analog values use paddle
show gameaxis 1
input and output
none
buttons
Returns a list of the buttons currently pressed on the gamepad.
show gamebuttons
booleans
buttom
boolean
Returns true if the specified gamepad button is currently pressed.
show gamebuttonp
containers
surname | container
value
Returns the value of the specified container under the given surname. See setsurname, set
show get "jones "car
camry
flow
word
none
Jumps to the execution point marked by label with the specified word. Similar to the BASIC GOTO command. Should be avoided if at all possible. See label.
label "start
print |This will repeat forever!|
go "start
containers
name | property
value
Returns the value of the property in the named property list. See plist
show gprop "john "phone
shapes and graphics
none
none
Causes lines to graduate in color from the pencolor value to the fillcolor value. nogradient disables it. See gradientp
cs gradient randpc randfc repeat 36 [fd 100 rt 170]
boolean
none
boolean
Returns true if gradient is enabled
show gradientp
boolean
expression | expression
boolean
Returns true if the first expression is greater than or equal to the second expression.
show greaterequalp 5 3
TRUE
show greaterequalp 3 3
TRUE
boolean
expression | expression
boolean
Returns true if the first expression is greater than the second expression.
show greaterp 5 3
TRUE
show greaterp 3 5
FALSE
control
worker (number) or workers (list)
none
Halts the specified worker or workers. The worker(s) must be owned by the turtle calling halt.
halt 7
halt [7 9]
words and lists
none
“hard space”
Returns a “hard space”, the space that exists at ascii code 160 as opposed to 32 (the standard space). This is needed if you want to use a space in a list or anywhere else the Logo parser might resolve a normal space to nothing.
show hardspace
turtles
list
none
Hatch clones the selected turtle and then executes the requests specified in the provided list in a new thread. It is automatically given an incremental name based on the name of the turtle that called hatch. A hatchlings HOME is its position when it is hatched. Once all the given requests have been executed the hatchling dies and its turtle track is deleted. If you wish to save its turtle track, you will need to use merge. See merge
hatch [right random 360 forward 100]
turtles
none
number
Returns the current hatch limit of the calling turtle. See sethatchlimit, hatch
show hatchlimit
turtles
workerid (number)
turtlename (word)
Returns the name of the hatchling controlled by the given worker IF that worker was created with a hatchling.
show hatchlingname 17
boolean
turtlename (word)
boolean
Returns true if the given turtlename is a hatchling.
show hatchlingp "seymour
FALSE
turtles
none
none
Returns a list of hatchlings belonging to the selected turtle.
show myrtle:hatchlings
turtles
turtlename (word)
workerid (number)
Returns the id number of the worker created with the specified hatchling, if the name supplied is that of a hatchling.
show hatchlingworker "hatchling123
12
movement and vectors
none
degrees
Returns the heading (x-axis) of the selected turtle in degrees. Heading is an accumulated, relative value that cannot be used in isolation to accurately reproduce an orientation when the turtle moves in three dimensions - for that, use orientation / setorientation. See pitch and roll
print heading
environment
primitivename (word)
none
displays the help entry for the provided primitive name. See viewhelp
help "forward
turtles
none
none
Hides all turtles. See showall
hideall
environment
none
none
Hides the turtle’s anchor from view. See showanchor, anchor
hideanchor
text
none
none
Hides the text cursor.
hidecursor
environment
none
none
Hides the mouse cursor. See showmouse
hidemouse
shapes and graphics
name (word)
none
Hides the specified overlay. See newoverlay
hideoverlay "myrtlesview
shapes and graphics
plotname (word)
none
Hides (all) the named plot(s). If you want to show / hide one specific instance of a placed plot (since you can place multiple), place them inside of a tag. See tag, showplot, plot
hideplot "myplot
shapes and graphics
name (word)
none
Hides the sticker specified by the provided name parameter. See placesticker
hidesticker "marquee
shapes and graphics
tagname (word)
none
Hides the specified tag from displaying. Be aware that this can alter the display of the rest of the turtle track, as the position of the turtle may be altered by the absence of the tag contents from rendering! To solve this problem, call ‘setposition position’ after calling ’endtag’ when closing a tag. Then, when you hide the tag, the turtle will still end up in the place it lands when the tag is visible, and the remainder of the turtle track rendering will not be disrupted.
hidetag "mytag
shapes and graphics
none
none
Hides the calling turtle’s ’turtle track’ or visible output. Make it visible again with showtrack.
hidetrack
turtles
none
none
Hides the turtle’s model. Show it again with showturtle
hideturtle
environment
none
number
Returns the number of items in the interactive history.
show historycount
environment
number
list
Returns the number-last interactive line entered, where 1 is the latest. Note that if you do ‘show historyitem 1’ from the interactive prompt, you will get ‘show historyitem 1’ as a result!
show historyitem 5
environment
number
list
Returns the last number lines in the interactive prompt’s history in reverse chronological order, where the first item is the last line entered. Note that if you do ‘show historylist 5’ from the interactive prompt, the first item will be ‘show historylist 5’. Also note that duplicate entries are removed automatically by the interactive prompt’s history code and will not be visible in historylist
show historylist 5
movement and vectors
none
none
Returns the currently selected turtle to the home position.
home
none
number
Returns the current hour in 24 hour time.
print hours
shapes and graphics
radius (number)
none
Creates an icosphere of a specified radius. See icosphereoid
icosphere 10
shapes and graphics
radius (number) | multiplier (number)
none
Creates an icosphereoid of a specified radius, stretched using the provided multiplier.
icosphereoid 10 2
conditionals and flow
expression | list
none
if can act both as an advisor (function) or a performer (command). If acting as a thinker and the provided expression resolves true, if returns the provided list. If acting as a doer and the provided expression resolves true, if executes the instructions in the provided list.
if 4 = 4 [forward 20]
show if 4 = 4 ["duck]
conditionals and flow
expression | list | list
none
ifelse can act as both an advisor or a performer. If the provided expression resolves true, ifelse (advisor) returns the first list, otherwise it returns the second list. If ifelse is acting as a performer, it executes either the first list or the second. See if, else
ifelse :container = 5 [do this] [do that]
show ifelse :container = 5 ["this] ["that]
environment
input
none
Consumes whatever is fed to it. Useful to pull things off of stacks but you don’t need them, such as message queues (listen) or containers (pop).
ignore listen
boolean
imagename (word)
boolean
Returns true if the specified imagename is defined.
show imagep "image
shapes and graphics
none
list
Returns a list of the currently defined images.
show images
input and output
file (word)
none
Imports (copies) the specified file into the current turtleSpace. Root / is the current user folder.
import "/myfile
containers
anything
anything
in simply passes whatever is passed to it. It is useful in two main contexts: first, to improve the readability of the make alternative put, as in put 5 in “container; second, to retrieve the value of another turtle’s container using query, as in query “myrtle [in :container].
pr query speedy [in :suspensions]
containers
name (word)
none
Increments the contents of the named container by one. Has no effect if the value of the container is not a number.
show "container
4
inc "container
show "container
5
words and lists
list
list
Returns a list of numbers indicating the order of provided list items were they to be ordered using the ORDER primitive.
show index [pig dog cow duck]
[3 2 4 1]
environment
none
none
Re-initializes the turtleSpaces environment. Clears the workspace and resets all the turtle states. Similar to restart.
initialize
input and output
word | number
none
Allows the user to enter a word or number which is stored in a container with the name of the first parameter, and whose length is limited by the number provided in the second parameter. For example, ‘input “name 10’ will wait for the user to enter their name, but it can be at most ten characters in length.
input "name 10
melody
print :name
melody
shapes and graphics
word, number or list
none
Renders text shapes alongside and to the front of the turtle rather than to the side (as with typeset) using the same size and color as typeset. Unlike typeset, the turtle does not move. See typeset.
repeat 8 [inscribe se char 32 repcount right 45]
place (number) | word or list | item
word or list
Returns the specified word or list with the specified item inserted at the specified place. Compare with replace
show insert 3 [1 2 3 4 5] 6
[1 2 6 3 4 5]
show insert 4 "piggy "f
pigfgy
show insert 1 [cat dog] "mouse
[mouse cat dog]
movement and vectors
[[x1 y1 z1] [x2 y2 z2]]
list
Returns a list of turtles inside the area denoted by the provided sets of co-ordinates.
show inside [[-100 -100 -100] [100 100 100]
[myrtle]
boolean
[x y z] [[x1 y1 z1] [x2 y2 z2]]
boolean
Returns true if the first set of three-dimensional co-ordinates is within the cube created between the second and third sets of coordinates.
show insidep [0 0 0] [[-10 -10 -10] [10 10 10]]
true
words and lists
number or word | number, list or word
number
Returns the number of instances of the first parameter in the second parameter.
print instances 3 [1 2 3 3 4 5]
2
print instances "l "volleyball
4
pr instances 5 123552
2
mathematics
number
number
Returns the integer value (rounded down) of the provided number.
show integer 23.34
23
control
turtle (word) | instructions (list)
none
Stops all workers executing in the specified turtle, and creates another to preform the specified instructions. The interrupted execution does not resume after the instructions have been executed. Similar to arrest “turtle ask “turtle [instructions]
interrupt "snappy [orbitleft 90]
mathematics
number1 (number) | number2 (number)
number
Returns the integer of the quotient (division) of the two provided input numbers. See quotient, remainder
show intquotient 22 7
3
text
none
none
Causes subsequent text to be displayed in inverse (foreground color as background color and vice-versa).
inverse
width height
none
Draws an isosceles triangle of the specified width and height, with the turtle positioned at the center of the lower side, and the triangle pointing in line with the turtle’s current orientation.
repeat 18 [iso 20 60 rollright 10]
words and lists
index list
Returns the individual list item indicated by the index number as a word or number.
show item 4 [dog cow pig frog]
frog
show item 2 [10 20 30]
20
words and lists
list expression
list
Iterate is a functional version of foreach. It takes a list to be processed, and an expression to evaluate. In the expression, the item to be processed is represented by :item
print iterate [3 5 6] [:item * 3]
9 15 18
movement and vectors
steps (number)
none
Moves the turtle forward the given number of turtle steps without drawing, regardless of the pen state.
jump 20
text
none
word
Returns left, right, center or none, dependent on the current setting.
show justify
left
environment
none
none
Causes keypresses to make various beeping noises. See nokeyclick
keyclick
boolean
none
boolean
Returns true if keyclick is enabled. See keyclick
show keyclickp
words and lists
list
number
Returns the index of the first largest list item.
show largest [10 100 1000]
3
print last “frog
g
print last [frog pig duck]
duck
words and list
number | word or list
word or list
Returns the specified number of leading items (characters or list items) in the provided word or list. See trailing
print leading 4 "teleporter
tele
show leading 2 [dog cat pig frog]
[dog cat]
movement and vectors
degrees
none
Turns the selected turtle to the left the specified number of degrees. See right
left 90
lt 45
words and lists
none
[
Returns a left square bracket. Useful for times when turtleSpaces won’t allow you to use an actual left bracket. See rightbracket
print "[
MISSING ]
print leftbracket
[
text
none
none
Left justifies any text output using print. This is the default behavior. If you want to use multiple spaces in print output, you need to disable justify with nojustify
leftjustify
boolean
expression | expression
boolean
Returns true if the first expression is less than or equal to the second expression.
show lessequalp 3 5
TRUE
show lessequalp 3 3
TRUE
boolean
expression | expression
boolean
Returns true if the first expression is less than the second expression.
show lessp 3 5
TRUE
show lessp 5 3
FALSE
turtles
none
“libby
Libby is the library turtle. She stores procedures to be used by any other turtle. She does not execute procedures herself. The libby primitive simply returns “libby, to avoid having to put the " on the front of her name when addressing her. See myrtle, snappy
setturtle libby
turtles
none
number
Returns the light status of the calling turtle, either 0 (not a light), 1 (spot light) or 2 (point light). See setlight
show light
shapes and graphics
none
none
Enables lighting for lines. Normally off by default. As lines have no ‘side’, their ’normal’ (the direction in which light is reflected) needs to be manually set using setlinesnormal. nolightlines disables it.
lightlines
shapes and primitives
length (number)
none
Creates a line of the specified length in front of the calling turtle, without moving that turtle.
repeat 36 [if oddp repcount [line 20] else [line 40] rt 10]
words and lists
word | word
list
Takes two words and returns a list. You can use more or less than two words if you surround the entire list primitive with round brackets, as in the example.
show list "frog "pig
[frog pig]
show (list "frog "pig "duck)
[frog pig duck]
shapes and graphics
none
none
Prints out the 64 (0-63) color indexes and their associated RGB values. See colors, showcolors
listcolors
turtles
none
message (list)
Returns the message on the top of the messsage queue, which is a list containing two items: the name of the turtle that sent the message, and the message itself (which can be a number, word or list). If there are no messages in the queue, listen will block until there is a message to retrieve.
show listen
turtles
none
boolean
Returns true if there is a message waiting for the calling turtle. See listen, tell
show listenp
input and output
none
none
Lists the files and folders in the current working directory
listfiles
shapes and graphics
none
none
Prints a list of the currently defined overlays.
listoverlays
booleans
item
boolean
Returns true if the provided item is a list.
show listp [frog pig]
TRUE
shapes and graphics
none
none
Prints a list of the currently defined plots.
listplots
environment
none
none
Prints a list of all built-in primitives.
listprimitives
environment
none
none
Prints the names of the procedures currently belonging to the calling turtle. Similar to show procs
listprocs
control
none
none
Displays a list of operating workers.
listworkers
environment
none
none
Prints out the currently defined zones in the Space occupied by the calling turtle.
listzones
input and output
projectname (word)
none
Loads the specified project from disk. If that project has a procedure called .autostart defined in the Myrtle turtle, that procedure is executed upon load.
load "myproject
input and output
imagename (word) | imagefile (word)
none
Loads the specified image from disk into memory. PNG is the only supported image type.
loadimage "myimage "imagefile.png
input and output
modelname (word) | modelfile (word)
none
Loads the specified model file into the specified model name, replacing it if it already exists or creating it if necessary.
loadmodel "mymodel "modelfile.mdl
input and output
musicname (word) | musicfile (word)
none
Loads the specified music file into memory.
loadmusic "mymusic "music.sng
input and output
filename (word) | plotname (word)
Loads the specified plot file into the specified plot name. The plot does not need to have been previously defined. See plot
loadplot “myplotfile “myplot
tables
tablename (word) | filename (word)
none
Loads the specified filename from disk into the specified table.
loadtable "mytable "mytable.tbl
shapes and graphics
tagname (word) | tagfile (word)
none
Loads the contents of the specified file into the specified tagname. loadtag creates a new tag at the end of the turtletrack if the tagname does not already exist. See savetag
loadtag "mytag "tagfile
shapes and graphics
filename (word)
none
Loads the saved turtle track, replacing the current turtle track. See savetrack
loadtrack "turtletrack
sound and music
soundname (word) | filename (word)
none
Loads the given sound filename into the given sound definition. turtleSpaces uses the ‘ogg’ file format. See playsound
loadsound "honk "honk.ogg
containers
word or list
none
Changes the scope of the container(s) specified by the supplied word or list to local - that is, they are only accessible by the current procedure, and only while it is executing. To preserve the state of the container when the procedure is not executing, use private. See make
local "container
local [container1 container2]
movement and vectors
co-ordinates (list)
list
Returns a list of isRight, isAbove, isAhead where a value of 1 indicates the target co-ordinates are in those areas relative to the turtle’s forward view, 0 indicates that the co-ordinates are on the same plane as the calling turtle as appropriate, and -1 indicates the co-ordinates are in the opposite region (eg a -1 for isRight indicates it is to the left of the turtle’s forward vector / view).
snappy:show location myrtle:position
[0 0 1]
myrtle:show location snappy:position
[0 1 0]
mathematics
number
number
Returns the log of the given number.
show log 5
0.698970004336
words and lists
list
number
Returns the item number of the first longest item in the list by number of characters or digits. See count
print longest [pig duck cow]
2
print longest [1000 100 10]
1
words and lists
word, long word or list | word, long word or list
longword
Longword allows you to create a long word from two (or more, if enclosed in parentheses) other long words, words, or lists.
make "longword longword "frog "duck
make "newword (longword "frog "duck [1 2 3])
print :newword
frog duck 1 2 3
boolean
word, longword or list
boolean
Returns true if the provided input is a long word (a word that contains spaces).
show longwordp |I am a duck|
sound and music
word
none
Repeatedly plays the sound indicated by the provided word. Stop it with stopsound. See stopsound
loopsound "sheep
movement and vectors
turtle-units
none
‘Lowers’ the turtle (moves back along its up vector). Same as doing ‘down 90 forward turtle-units up 90’. For example, Myrtle in her home position when turtleSpaces is started will move away from the Snappy camera turtle if you lower her. See raise
lower 100
words and lists
word
word
Returns a lowercased version of the provided word.
show lowercase "FrOg
frog
show iterate [DUCK PIG FROG] [lowercase :item]
[duck pig frog]
words and lists
word or number | list
list
Adds the provided word or number to the provided list. See fput
show lput 40 [10 20 30]
[10 20 30 40]
show lput "pig [dog cow duck]
[dog cow duck pig]
containers
name (word) | word, list, evaluated-list, expression or number
names (list) | list of words, numbers or lists
none
Make creates a container (also known as a container) with the name specified by the first parameter, containing the item(s) specified or generated by the second parameter. It also works with lists of both the former and the latter (see examples), but if you want to assign the returns from advisers you will need to use a softlist {}. See name and put
make "container 5
print container
5
make "container [dog pig cow]
show "container
[dog pig cow]
make [ducks frogs pigs] [4 3 1]
show :ducks
4
show :frogs
3
make [x y z] {xpos ypos zpos}
containers
name (word) | expression
Contains a runtime-evaluated expression, or ‘mutated’ container. This allow expressions to be stored inside containers, and rather than being evaluated when stored, they are evaluated when recalled. A container that contains a REX may only contain a single REX and nothing else. See also name! and put!
make! “moo iterate (array 1 + random 10) [“moo]
pr :moo
make! "clock (se hours minutes seconds)
pr :clock
words and lists
primitive (word) or list | list
list
MAP outputs a word or list, depending on the type of the data input, of the same length as that data input.(If more than one data input are given, the output is of the same type as data1.) Each member of the output is the result of evaluating the template list, filling the slots with the corresponding member(s) of the data input(s). (All data inputs must be the same length.) In the case of a word output, the results of the template evaluation must be words, and they are concatenated with WORD. if first parameter is “primitive, map passes iterations to the specified primitive and returns the results in a list. See examples
show map [? * ?] [2 3 4 5]
[4 9 16 25]
show map [(word ?1 ?2 ?1)] [[a b c] [d e f]]
[ada beb cfc]
show map "word [[a b c] [d e f]]
[ad be cf]
words and lists
template (list) | input (list)
result (list)
outputs a list formed by evaluating the template list repeatedly and concatenating the results using SENTENCE. That is, the members of the output are the members of the results of the evaluations. The output list might, therefore, be of a different length from that of the data input(s). (If the result of an evaluation is the empty list, it contributes nothing to the final output.) The data inputs may be words or lists.
In a template, the symbol ?REST represents the portion of the data input to the right of the member currently being used as the ? slot-filler. That is, if the data input is [A B C D E] and the template is being evaluated with ? replaced by B, then ?REST would be replaced by [C D E]. If multiple parallel slots are used, then (?REST 1) goes with ?1, etc.
In a template, the symbol # represents the position in the data input of the member currently being used as the ? slot-filler. That is, if the data input is [A B C D E] and the template is being evaluated with ? replaced by B, then # would be replaced by 2.
make "numbers [zero one two three four five six seven eight nine]
show mapse [item ?+1 :numbers] 5789
[five seven eight nine]
show mapse [sentence (word "With ?) "You] [in out]
[Within You Without You]
show mapse [sentence ? "Warner] [Yakko Wakko Dot]
[Yakko Warner Wakko Warner Dot Warner]
control
turtle (word)
none
Marco causes the calling turtle to wait until the specified turtle calls polo. This allows for some simple synchronisation between turtles. See marcop, marcos, polo
marco "snappy
boolean
none
boolean
Returns true if the calling turtle has any current marcos attributed to it. If a turtle is expecting a marco, it can simply wait until marcop is true. See marco
show marcop
control
none
list
Returns a list of all the turtles that have called marco on the calling turtle. See marco
show marcos
shapes and graphics
turtle-units (number)
none
Mark moves the turtle forward the specified turtle units, drawing a quad using the ‘marker’ rather than the pen. You can set the diameter of the ‘mark’ using setmarkerwidth
mark 10
none
turtle-units (number)
Returns the width of the current marker in turtle-units.
show markerwidth
2
words and lists
search pattern (word) | list
number
Returns the item number of the first matching search result instead of the result itself. See search
print match "*g [cat duck frog]
3
words and lists
search pattern (word) | list
list
Returns a list of the item number(s) matching the search word instead of the results themselves. See search
print matches "*g [pig duck cat frog]
[1 4]
booleans
search pattern (word) | list
boolean
Returns true if doing a search of the provided list using the provided search word would return a result.
show matchp 10 [10 20 30]
true
mathematics
number | number
number
Returns the greater of the two provided numbers. See min
show max 4 6
6
environment
none
none
Maximizes (makes full-screen) the turtleSpaces window. See restore (which restores it)
maximize
words and lists
word or list
word or list
Member returns the part of the second parameter in which the first parameter is the first element.
show member "duck [pig duck frog]
[duck frog]
show member "du "pigduck
"duck
boolean
word or list
word or list
Returns true if the result of calling member using similar parameters is not empty.
show memberp "duck [pig duck frog]
true
shapes and graphics
none
none
Causes the turtle track of a hatchling to merge with its parent at the start of the parents turtle track. The hatchling’s turtle track is empty after the merge. See hatch
merge
turtles
target (word)
none
locks the calling turtle’s orientation to that of the target turtle. nomimic turns it off
mimic "snappy
turtles
none
turtle (word)
Returns the name of the turtle the calling turtle is mimicking, if any.
show mimicking
boolean
none
boolean
Returns true if the calling turtle is mimicking another turtle. See mimic
show mimicp
mathematics
number | number
number
Returns the lesser of the two provided numbers. See max
show min 4 5
4
environment
none
number
Returns the current minutes value of the computer’s sytem clock
print minutes
10
environment
none
word
Returns the name of the currently selected model.
print model
myrtle
environment
word
boolean
Returns true if there is a model with the name of the provided word.
show modelp "turtle
true
mathematics
numerator (number) | denominator (number)
Returns the floating-point remainder of the division of the supplied numerator by the denominator, as opposed the remainder primitive, which takes and returns integer (whole) values. See remainder
show mod 22 6.5
2.5
none
list
Returns a list of the currently defined models.
show models
[myrtle turtle]
shapes and graphics
none
scale (number)
Returns the calling turtle’s current modelscale value. Default is 1. See setmodelscale
show modelscale
environment
none
month (number)
Returns the current month.
show month
8
input and output
sourcefile (word) | destinationfile (word)
none
Moves the specified file to the specified destination.
movefile "myfile "newfile
input and output
none
number
Returns 0, 1 (left button), 2 (right button) or 3 (both buttons). See buttonp
show mousebutton
input and output
screenposition (list) | clicktype (number)
none
Simulates a mouse click. The provided screen position should be in terms of percentages of the width and height of the screen, with 0 being the left and top respectively. The second parameter is one of the following: 1 - left click, 2 - right click, 3 - both / middle click. This is useful for tutorials or test workers
mouseclick [50 50] 1
input and output
none
percentage (number)
Returns the current horizontal mouse position in terms of the percentage of the screen width, with 0 being the left edge.
show mousex
input and output
none
percentage (number)
Returns the current vertical mouse position in terms of the percentage of the screen height, with 0 being the top edge.
show mousey
boolean
musicname (word)
boolean
Returns true if the specified music name is loaded in memory.
show musicp "mymusic
sound and music
none
number
Returns the current music speed.
show musicspeed
sound and music
none
number
Returns the calling turtle’s music volume.
show musicvolume
control
none
id (number)
Returns the worker ID of the worker that calls it. See myworkers
show myworker
control
none
list
Returns a list of the IDs of the workers belonging to the calling turtle or its hatchlings. Hatchlings do not own workers, only ‘root’ turtles. myworkers doesn’t return any results if called by a hatchling. See newworker, workers
show myworkers
turtles
none
“myrtle
Myrtle is the turtle you see when you start up turtleSpaces, and she is the first turtle selected. Her name simply returns “myrtle, so a quote is unneeded when you invoke setturtle myrtle. See snappy, libby
setturtle myrtle
containers
number, word, longword, list, expression or container | name (word)
none
An alternative to make. Traditionally used for constants, eg name 3.14 “pi. See make, put
name 3.14 "pi
containers
expression | name (word)
none
Creates a mutated container, one whose expression is re-evaluated whenever it is accessed. See make!
name! (se hours minutes seconds) "clock
booleans
container (word)
boolean
Returns true if the specified container exists.
show namep "container
containers
none
list
Returns a list of the defined containers (their names).
show names
turtles
name (word)
none
Creates a new turtle, but unlike newturtle does not switch to it on creation.
nameturtle "fred
movement and vectors
position (list) | radius (number)
list
Returns a list of all the turtles within the specified radius of turtle-units from the specified position.
show near [0 0 0] 10
mathematics
number
number
Returns the negative of the provided number. You can also negate containers or advisor returns by prefixing them with -, eg -:container or -advisor. See abs
show negative 10
-10
show negative -20
20
shapes and graphics
name (word) | tagname (word) or [command list] (list)
none
Creates a new model, using either the contents of the specified tag, or the provided list of turtle commands. See setmodel
newmodel "sphere [icosphere 20]
newmodel "fromtag "tag
shapes and graphics
name (word) | turtle (word)
none
Creates a new camera ‘overlay’ or picture-in-picture with the specified name using the point of view of the specified turtle. You position the overlay on the screen using placeoverlay
newoverlay "myrtlesview "myrtle
shapes and graphics
name (word) | dimensions (list)
Defines a new plot (a grid of pixels or voxels) with the provided name, and of the provided dimensions. If the list has two numbers, a two-dimensional plot is created. If the list has three numbers, a three-dimensional plot is created. See placeplot
newplot “myplot [10 20]
newplot "myplot [5 5 5]
environment
name (word)
none
Creates a new space with the specified name.
newspace "myspace
shapes and graphics
name (word) | image (word)
none
Defines a new sticker using the provided image. See placesticker
loadimage "marqueeimage "marquee.png
newsticker "marqueesticker "marqueeimage
tables
name “word | [rows columns (sheets)] (list)
none
Creates a new table of the provided dimensions. Note that the dimensions are provided as a list of two (or three) numbers. If a number of sheets (third number) is provided, a third sheet number must also be provided in cell and setcell, and setsheet must be used to specify the sheet number for the srow, scol, replacerow, replacecolumn, row and column primitives. See setcell
newtable "mytable [3 20]
turtles
name (word)
none
Creates a new turtle with the given name.
newturtle "daisy
control
list
none
creates a new ‘worker’ and executes the contents of the list of primitives or procedures provided to it.
newworker [forever [rt random 180 fd random 100]]
control
list
number
newworkerid creates a new worker the same as newworker, but acts as a function and returns the thread ID of the new worker.
show newworkerid [forever [rt random 180 fd random 100]]
environment
name (word) | [x y z] (list) | [x y z] (list)
none
Creates a voxeloid ‘zone’, an invisible area of ‘sectors’ in turtleSpace that contain name / value pairs (keys) unique to those sectors. The first list provided to newzone specifies the number of sectors in the x direction, y direction and z direction, the second list specifies the size of those sectors in x, y and z. The zone is created to the up, right and under the turtle relative to its position BUT NOT its orientation, so in the positive x, positive y but negative z from the turtle’s position.
newzone "zone [50 50 50] [5 5 5]
shapes and graphics
none
none
Waits until the next frame of video is rendered. Useful for creating smooth animations in combination with norender and render (eg render nextframe norender) by otherwise disabling rendering except for one nextframe per loop. Warning: If norender is currently set, nextframe will wait indefinitely!
render nextframe norender
sound and music
none
none
Causes the calling turtle not to wait while TOOT and NOISE are played.
noaudiowait
sound and music
none
none
Disables audio attenuation for the calling turtle. See attenuate
noattenuate
environment
none
none
Disables blocks mode
noblocks
environment
none
none
Disables ‘camcontrol’ mode
nocamcontrol
words and lists
none
none
Makes search, sort and comparisons case sensitive. See caseinsensitive
nocaseinsensitive
environment
none
none
Disables debug. See debug
nodebug
environment
none
7179
nodes returns 7179, the blocks of memory free at a ‘cold start’ of Apple Logo on an Apple IIe 128K computer. It exists here only for compatibility.
show nodes
7179
environment
none
none
Disables dragselect. See dragselect
nodragselect
input and output
none
none
Ends a current dribble, if any. See dribble
nodribble
control
none
none
Disables the ability of the escape key to halt all execution. See escape
noescape
turtles
mone
none
Disables fluid mode on the calling turtle.
nofluid
turtles
none
none
Disables follow mode in the calling turtle.
nofollow
sound and music
frequency (number) | duration (number)
none
Generates noise output of the specified frequency, and duration in 60ths of a second. See toot
noise 2000 100
text
none
none
Disables justify (and word wrapping)
nojustify
environment
none
none
Disables keyclick if enabled. See keyclick
nokeyclick
shapes and graphics
none
none
Disables line lighting. See lightlines
nolightlines
environment
none
none
Disables the on-screen display. See osd
noosd
environment
none
none
Disables paging. See paging
nopaging
environment
none
none
Disables paper. See paper
nopaper
shapes and graphics
none
none
Disables the renderer. There will be no updates to the graphical output while norender is enabled. This includes view turtle (camera) movement! Pressing the escape key will re-enable render, as will the render primitive. See render
norender
text
none
none
Causes subsequent text to be displayed normally, eg without inverse or flash. See inverse, flash
normal
shapes and graphics
none
none
Disables speckling of voxels and quads. See speckle
nospeckle
movement and vectors
none
none
Causes calling turtle to appear in lists generated by near. See stealth
nostealth
control
none
none
Cancels a current sync. See sync
nosync
boolean
boolean
boolean
Reverses an input boolean, an expression that resolves to either true or false
print not 5 = 4
TRUE
sound and music
none
number
Returns the current channel used to play notes by the playnotes primitive. See setnoteschannel
show noteschannel
boolean
none
boolean
Returns true if the playnotes primitive is currently playing.
show notesp
sound and music
none
number
Returns the current speed of playnotes playback.
show notespeed
movement and vectors
none
none
Untethers the selected turtle from the orbit anchor point. When the turtle is untethered, the anchor point moves relative to it.
notether
shapes and graphics
none
none
Causes the calling turtle not to generate a track and erases any existing track without changing the turtle’s position, after which any shape and graphics primitives are ignored. See track
notrack
shapes and graphics
none
none
Stops the calling turtle’s ’track’ render from updating. Its current buffered render will continue to be displayed. This is handy for complex scene creation – you can choose to reveal parts of the scene as they are created. See trackrender, hidetrack, showtrack, render, norender
notrackrender
environment
none
none
Disables transcript, if enabled. See transcript
notranscript
words and lists
word
number
Converts a word or list item into a number. Usually turtleSpaces will convert a word into a number automatically if the word is supplied to a numeric function, but there are cases such as comparison operators where you may need to convert the word to a number manually in order to ensure correct evaluation.
print number "20
20
shapes and graphics
none
none
Causes the surface of shapes to only be ’lit’ from one side – in OpenGL parlance, only one side has ’normals’. This is the default. If you wish both sides of a shape’s surface to be lit, invoke twosided. See twosided
notwosided
words and lists
list
list
Returns a list containing only those elements that are numbers.
show numbers [12 pig 134 cow]
12 134
booleans
word
boolean
Returns true if the supplied input is a number.
show numberp 15
TRUE
show numberp "dog
FALSE
shapes and graphics
size (number)
none
Creates a octahedron (8-sided shape) of the specified size.
octahedron 5
shapes and graphics
size (number) | ratio (number)
none
Creates a octahedroid (8-sided shape) of the specified size and stretched using the specified ratio.
octahedroid 5 2
octahedroid 10 0.5
boolean
number
boolean
Returns true if the provided number is odd (1, 3, 5, 7…)
show oddp 6
booleans
none
none
Same as FALSE
show off
booleans
none
none
Same as TRUE
show on
conditionals and flow
list
none
Causes the calling turtle to execute the supplied list of instructions when an error is encountered rather than stop execution. It then continues execution from the point the error was encountered. onerror is ‘scoped’ to the procedure it is called from.
onerror [print "Caught!] show 1 / 0
Caught!
input and output
filename (word)
none
Opens a file for reading or writing. You must also setread / setwrite the file in order to read from / write to it. See close, setread, setwrite
open "myfile
conditionals and flow
expression | expression
boolean
Returns true or false based on whether or not one or more of the supplied expressions are true. or takes two expressions by default, but can take more than two if the entire or statement is wrapped in brackets, eg: (or expr1 expr2 expr3 …) See and
show or 1 = 1 2 = 3
TRUE
movement and vectors
none
turtle-units (number)
Returns the distance between a turtle and its anchor point. See setanchor, dropanchor
show orbitdistance
movement and vectors
degrees (number)
none
Orbits down from (beneath) the turtle around its anchor point the specified number of degrees. Note that the turtle goes to its destination directly regardless of the status of fluid, and if the pen is down a line will be drawn between the start and destination with no intermediary points. See setanchor, dropanchor
orbitdown 90
movement and vectors
degrees (number)
none
Orbits the turtle left around its anchor point the specified number of degrees. Note that the turtle goes to its destination directly regardless of the status of fluid, and if the pen is down a line will be drawn between the start and destination with no intermediary points. See setanchor, dropanchor
orbitleft 90
movement and vectors
degrees (number)
none
Orbits the turtle right around its anchor point the specified number of degrees. Note that the turtle goes to its destination directly regardless of the status of fluid, and if the pen is down a line will be drawn between the start and destination with no intermediary points. See setanchor, dropanchor
movement and vectors
degrees (number)
none
Orbits up from (above) the turtle around its anchor point the specified number of degrees. Note that the turtle goes to its destination directly regardless of the status of fluid, and if the pen is down a line will be drawn between the start and destination with no intermediary points. See setanchor, dropanchor
orbitup 90
movement and vectors
vector (list) | degrees (number)
none
Orbits the specified number of degrees around the turtle’s anchor point using the specified vector. To orbit in the opposite direction, specify a negative number of degrees. Note that the turtle goes to its destination directly regardless of the status of fluid, and if the pen is down a line will be drawn between the start and destination with no intermediary points. See setanchor, dropanchor
orbitvector updir 10
words and lists
word number or list
none
Returns the input in alphabetical and / or numeric order, numbers first.
show order "frog
fgor
show order 54321
12345
show order jq831md
138djmq
show order [pigeon duck goose chicken]
[chicken duck goose pigeon]
movement and vectors
none
list
Returns the current origin co-ordinates. See setorigin, home
show origin
[0 0 0]
movement and vectors
none
list
Returns the current orientation, in the order specified by orientationorder. So if orientation order is set to “phr, then the first value returned by orientation will be pitch, the second heading and the third roll. See orientationorder
show orientation
movement and vectors
none
word
Returns the current order heading, pitch and roll are processed when setorientation, setheading, setpitch or setroll is used.
show orientationorder
"hpr
environment
input
none
Displays the provided input on the ‘on-screen display’, a text overlay layer used to display system messages (typically errors). The message remains until you use noosd to turn it off. See noosd
osd [Game over!]
boolean
none
boolean
Returns true if the OSD is currently on. See osd
show osdp
conditionals and flow
list
none
If no case statement has been satisfied since the last switch, execute the provided list. See switch, case
otherwise [pr |Eat a sandwich.|]
conditionals and flow control
input
output
Used by procedures to return output to a calling procedure or function. The input and output are effectively the same.
to duck
output "quack
end
print duck
quack
shapes and graphics
width (number) | height (number)
none
Creates a filled oval of the specified width and height. See ellipse
oval 50 20
boolean
name (word)
boolean
Returns true if the specified overlay exists. See newoverlay
show overlayp "overlay
shapes and graphics
none
list
Returns a list of the currently defined overlays.
show overlays
text
none
none
Overlays the full text screen over the graphics output, basically a transparent textscreen. Not to be confused with camera overlays. See textscreen, splitscreen, fullscreen
overlayscreen
control
none
none
Calms (stops) all turtles except for the turtle who calls pacify. See calm
pacify
environment
none
none
pause and wait for a keypress if text output would push previous text output off of the screen generated since the last page prompt, interactive mode prompt, question, input, readchar or readlist - default is enabled. nopaging turns it off
paging
input and output
paddle (number)
value (number)
Takes a value from 0 to 3 that indicates the ‘paddle’, which is the axis value of a controller and can be from 0 to 255. Paddles can be controlled either from a joypad (paddle 0 and 1 is usually the horizontal and vertical axes of the left thumbstick respectively, and 2 and 3 the right thumbstick) or using the mouse (paddle 0 and 1 return results based on the mouse’s position on the window.) See buttonp, gameaxis, gamebuttons
show paddle 0
environment
none
none
Enables ‘paper’ (white) mode. nopaper turns it off.
boolean
none
boolean
Returns true if paper mode is enabled. See paper
show paperp
words and lists
word
list
Outputs a list that is created from parsing the provided word. Useful for converting the output of readword into a list, or converting other ’long words’ (words with spaces) into their component parts.
show parse |dog cat pig|
[dog cat pig]
input and output
none
word
Returns the current file path.
show path
conditionals and flow
none
none
Causes execution in the calling worker to pause and return to the prompt. Execution can be continued with co. Pause only works with the main (archon) worker. NOTE: pause DOES NOT WORK in interactive mode (only in a procedure!) See co
pause
sound and music
none
none
Pauses playback of music, if music is playing. See resumemusic
pausemusic
shapes and graphics
width | height | depth
none
Creates a lined wedge around and beneath the calling turtle. The width distance is the distance to one side of the turtle (the total width of the peak is double the provided width value).
peak 10 20 30
input and output
none
character
Returns the current next character in the keyboard buffer, if any. This character is left in the buffer. See readchar, clearchar
show peekchar
shapes and graphics
none
number
Returns the current pen color.
show pencolor
shapes and graphics
none
none
Puts the calling turtle’s ‘pen’ down (causes it to draw a line when moved).
pendown
shapes and graphics
none
number
Returns the calling turtles pen opacity. See setpenopacity
shoe penopacity
shapes and graphics
none
shade (number)
Returns the current pen shade value. See setpenshade
show penshade
shapes and graphics
none
none
Lifts the calling turtle’s pen up, it won’t draw a line when it moves. See pendown
penup
mathematics
none
number
Returns 3.141592653589793
show pi
3.141592653589793
words and lists
list
item
Returns a random item from the provided list.
show pick [dog cow sheep]
sheep
setbackgroundcolor pick [1 4 5]
shapes and graphics
radius (number) | degrees (number)
none
Creates a pie-chart like object of the specified radius and degrees, starting at the turtle’s right vector and moving counter-clockwise.
pie 20 270
shapes and graphics
none
none
Drops a ‘pin’, for use with pinfrag and pinshard
pin
shapes and graphics
none
none
Creates a ‘frag’ using the last three dropped ‘pins’. See pin, frag
pinfrag
shapes and graphics
none
none
Creates a ‘shard’ using the last three dropped ‘pins’. See pin, shard
pinshard
turtle
none
pitch (number)
Returns the pitch (attitude) of the current turtle
print pitch
shapes and graphics
name (word) | [x1% y1% x2% y2%] (list)
none
Places the named overlay on the screen over the list of co-ordinates which are specified in terms of percentages. See newoverlay
placeoverlay "myrtlesview [0 0 50 50]
shapes and graphics
name (word) | voxel / pixel size (list)
none
Places the named plot at the current turtle position using pixels (by providing a list of two) or voxels (by providing a list of three)
placeplot "myplot [10 10]
would place a plot using pixels 10 turtle-units in size, while
placeplot "myplot [5 5 5]
would place a plot using voxels 5 turtle-units in size
shapes and graphics
name (word) | [x1% y1% x2% y2%] (list)
none
Places the sticker with the provided name over the area of the screen specified by the provided list, which is in terms of percentages of the screen dimensions, where 100% is the right / bottom and 0% is the left / top. As the name suggests, a sticker is a static image which does not move with the camera view, as if you stuck a sticker to your display. See stickers, stickerp
loadimage "marquee "marquee.png
newsticker "marqueesticker "marquee
placesticker "marqueesticker "marquee [25 25 75 75]
turtles
none
list
Returns a list of the calling turtle’s currently defined procedures.
show procs
boolean
name (word)
boolean
Returns true if the calling turtle has a procedure with the provided name.
show procp "procedure
sound and music
notes [list]
none
Plays back the provided list of notes. L specifies note length.
playnotes [L3 A3 L2 Bb3 C#3]
sound and music
musicname (word)
none
Begins playing the named music. The music needs to have first been loaded into memory using loadmusic
playmusic "mysong
boolean
none
boolean
Returns true if music is currently playing.
show playmusicp
sound and music
“sound (word)
none
Plays a sound, where “sound can be a loaded sound or a ‘built-in’ one from the list given in the example.
air crack laugh stapler
air2 crash laughter static
air3 crinkle lid step
alarm crow lightbulb step2
alarm2 descent lion switch
alien dice meow switch2
alien2 doh missile tear
alien3 doodoo oof thwap
applause door paddle tiger
arcade drip pew ting
augh drop pingpong ting2
aw dunk plastic tinpan
bark evil plastic2 tires
beep explosion please toaster
beep2 fall pong tuee
beep3 fire pop tweet
beep4 fire2 powerup ufo
bell ghost radio ufo2
bell2 glass ratchet ufo3
blastoff glitch rattle ufo4
blub gong rattle2 ufo5
boing growl rattle3 ufo6
bong gun ringring warning
buc gun2 rocket whip
button gun3 rooster whip2
buzz gurgle saw whoosh
candy ha scanner wind
carkeys hangup scissors wind2
carstart hangup2 sheep window
cellphone hit sheep2 witch
cheers honk sheep3 wood
chomp honk2 slap wrapper
clang interference slide zap
click jingle sneeze zap2
click2 knock soda zap3
click3 laser spin zblrf
close latch spinout zip
cluck latch2 squeak zipper
containers
propertylistname (word)
propertylist (list)
Outputs the property list associated with the supplied name. Any word can have a property list associated with it – a list of ‘properties’ and their values. plist returns a list of these pairs sequentially: [property1 value1 property2 value2 etc.] See pprop
show plist "propertylist
shapes and graphics
coordinates (list)
none
Plots a pixel / voxel at the specified co-ordinates in the currently selected plot. The list may contain two or three numbers depending on if the plot is two- or three-dimensional. See placeplot
plot [10 20]
plot [10 20 10]
shapes and graphics
coordinates (list)
number
Returns the color (if any) of the specified pixel / voxel in the currently selected plot. The list of coordinates may contain two or three numbers, depending on if the selected plot is two- or three-dimensional. See plot
show plotcol [10 20]
show plotcol [10 20 10]
shapes and graphics
start co-ordinates (list) | end co-ordinates (list)
none
Plots a line from and including the first set of provided co-ordinates to and including the second set of provided co-ordinates. The co-ordinates may contain two or three numbers dependent on if the plot has two or three dimensions. See plot
plotline [1 1 1] [5 5 5]
shapes and graphics
none
list
Returns a list of the currently defined plots. See newplot, placeplot, plot
show plots
environment
name or names (word or list)
none
Prints out the specified procedure or procedures to the screen.
po "procedure
po [procedure1 procedure2]
environment
none
none
Prints out the definition of every procedure and the value of every container in the workspace.
poall
input and output
filename (word)
none
Prints out the specified text file to the screen.
pofile "textfile
control
turtle (word)
none
Calls polo on the specified turtle. See marco, marcop, marcos
polo "myrtle
shapes and graphics
radius (number) | sides (number)
none
Draws a convex polygon of the specified radius and number of sides.
poly 10 6
shapes and graphics
width (number) | height (number) | sides (number)
none
Draws a convex polygon of the specified dimensions and sides.
polyellipse 20 10 10
shapes and graphics
width (number) | height (number) | sides (number)
none
Creates a filled convex polygon of the specified dimensions and sides.
polyoval 10 20 5
shapes and graphics
radius (number) | sides (number)
Creates a filled convex polygon of the specified radius and number of sides.
polyspot 20 5
containers
container(s) (word or list)
none
Prints out the name and value of the named container(s)
pon "container
containers
none
none
Prints out the names and values of every container in the workspace.
pons
containers
container
item
‘Pops’ the item at the front of the container and returns it, removing it from the contained word or list. Equivalent to: make “pop first :list make “list butfirst :list
See push
make "result pop "pushlist
environment
none
none
Prints all of the calling turtle’s procedures to the screen.
pops
turtles
none
none
‘Pops’ a turtle state off of the stack and restores the turtle to it. See pushturtle
popturtle
movement and vectors
none
[x y] (list)
Returns the x and y co-ordinates of the turtle. For all three dimensions, use position
show pos
movement and vectors
none
[x y z] (list)
Returns the co-ordinates of the turtle. For just the first two dimensions, use pos
show position
environment
procedure name or names (word or list)
none
Prints the ’title(s)’ of the supplied procedure(s) stored in the calling turtle, the ’to’ declaration that includes the procedure’s parameters.
pot "myprocedure
TO MYPROCEDURE :SIZE :SHAPE
environment
none
none
Prints the titles of every procedure stored in the calling turtle.
pots
mathematics
number | number
number
Returns the power of the second number to the first number. Similar to ^.
show power 5 5
125
containers
name | property | value
none
Property lists are a special type of container that hold multiple property / value pairs. You can have a property list and a non-property list container with the same name.
pprop "addresses [Marty McFly] [9303 Lyon Drive, Lyon Estates, Hill Valley CA 95420]
containers
none
none
Prints the property list containers belonging to the calling turtle.
pps
input and output
none
path
Returns the ‘prefix’ or current file system path. / is the user’s folder.
show prefix
environment
none
list
Returns a list of all available primitives (also known as primitives).
show primitives
text
input
none
Prints the input (word, number, list, expression) to the screen. If leftjustify, rightjustify or center is enabled, then print automatically wraps its output. See nojustify to disable wrap.
print "Hello!
print |How are you?|
print [I am fine]
print 5 * 3
print myrtle:position
shapes and graphics
width | height | depth
Creates a lined prism to the right, forward and under the turtle.
prism 20 10 30
containers
word
none
Initialises a private container with the name provided. A private container is a container which only exists and whose value persists inside of a procedure. This allows you to construct a procedure that modifies and stores internal parameters without losing them when that procedure exits, and needing to store them in the turtle. See the examples.
TO test
if not namep "frog [private "frog make "frog 1 stop]
inc "frog
show :frog
END
TO test :switch
private "var
if :switch = "a [make "var 1]
if :switch = "b [inc "var show :var]
END
mathematics
number1 (number) | number2 (number)
number
Returns the product of (multiplies) its two inputs, similar to the * operator.
show product 4 5
20
movement and vectors
turtle-spaces (number)
none
Pulls the calling turtle toward its anchor point the specified number of turtle-spaces. Stops if it reaches its anchor point.
pullin 40
movement and vectors
turtle-spaces (number)
none
Pulls the calling turtle out away from its anchor point the specified number of turtle-spaces.
dropanchor repeat 20 [penup pullout 10 pendown repeat 36 [orbitleft 10]]
containers
input (number, word, longword, list, primitive or container) | in | name (word)
none
Another syntax for make used by some Logos. ‘in’ is a simple prmitive that forwards whatever is passed to it. See in
put 5 in "counter
containers
expression | in | name (word)
See make!
put! (se hours minutes seconds) in “clock
tables
table (word) | [row column (sheet)] (list) | value
none
Sets the cell in the table with the provided name to the provided value. If no sheet number is provided, setcell will default to sheet 1, if the table has multiple sheets. See cell
setcell "table [4 5] 20
setcell "table3 [4 5 2] 30
environment
name (word) | value
none
Stores a key (name / value pair) in the current sector. A zone must be selected, and the calling turtle must be inside a sector for putsector to work. See newzone, whichsector, readsector
putsector "duck 123
shapes and graphics
size (number)
none
Creates a pyramid (5-sided shape) of the specified size.
pyramid 10
containers
item | container
none
“Pushes” the item on to the front of the specified container, making it the first item, and pushing the rest of the items to the right. If the container contains a word, push pushes the item on to the start of the word. If the container contains a list, push pushes the item on to the front of the list. To pull the item out of the container, use pop. Also see queue and dequeue (which do similar but to the end of the container).
push "frog "animals
turtles
none
none
‘Pushes’ the state of the turtle on to a stack (position, pen color, etc.) popturtle pulls the state back off of the stack again. Imagine drawing a tree with randomly extending branches. You can construct it by pushing the turtle’s state at each junction, then popping the turtle to return to it, then the previous one, etc.
pushturtle
shapes and graphics
size (number) | ratio (number)
none
Creates a pyramoid (stretched pyramid) of the specified size and stretch ratio.
pyramoid 10 2
shapes and graphics
width | height
Creates a ‘quad’, a two-dimensional filled rectangle of the specified width and height, to the front and right of the turtle.
quad 20 10
containers
item | container
none
Similar to push, except adds the provided item to the end of the container, appending it to the word or list inside it. See push
queue "item "container
turtles
turtle (word) | query (list)
result
Allows you to query another turtle’s internal state. See in
show query "snappy [position]
input and output
word or list
none
Asks the user the ‘question’ posed in the provided word or list. The answer is retrieved through the answer primitive. See answer
question [What is your name?]
sound and music
none
none
Stops playback of all sounds from all turtles. This doesn’t mute auto playback in general, only stops the currently playing sounds.
quiet
mathematics
number1 (number) | number2 (number)
number
Returns the first number divided by the second number, similar to using the / operator. See intquotient, remainder
show quotient 22 7
3.142857142857143
mathematics
number
number
Outputs the inverse cosine of its input in radians.
show radarccos 0.5
0.87758256189
mathematics
number
number
Outputs the inverse sine of its input in radians.
show radarcsin 0.5
0.479425538604
mathematics
number
number
Outputs the inverse tangent of its input in radians.
show radarctan 0.5
0.463647609001
mathematics
number
number
Outputs the cosine of the input in radians.
show radcos 0.5
mathematics
number
number
Outputs the sine of the input in radians.
show radsin 0.5
mathematics
number
number
Outputs the tangent of the input in radians.
show radtan 0.5
movement and vectors
turtle-units (number)
none
Raises (elevates) the currently selected turtle by the specified number of turtle-units. Draws a line if the pen is down. See lower
raise 20
shapes and graphics
width (number) | height (number) | depth (number)
none
Creates a filled wedge, or ‘ramp’ using the provided dimensions.
ramp 10 20 30
mathematics
maximum (number)
number
Returns a random integer (whole number) between 0 and the specified maximum, but not including that maximum. So, for example, random 2 returns one of two numbers, 0 or 1. random 8 returns one of 8 numbers, between zero and 7. Note that random and its input must be isolated from other expressions using brackets () if you don’t want a random number based on that expression, for example, unless you want random 15 + 10 to return a number between 0 and 34, you need to use (random 15) + 10 to return a number between 10 and 24
show random 16
3
show 1 + random 15
4
show (random 15) + 1
4
environment
none
none
Selects a random background color (0 - 15). See setbackgroundcolor
repeat 50 [randbg] setbg 0
environment
none
none
Selects a random background shade (0-15). See setbackgroundshade
randbs
shapes and graphics
none
none
Sets a random fill color (1 - 15). See setfillcolor
randomfillcolor sphere 10
shapes and graphics
none
none
Sets a random fill shade value. See setfillshade
randomfillshade
shapes and graphics
none
none
Sets a random pen color (1 - 15)
pendown repeat 10 [randvec randompencolor fd 100 home]
shapes and graphics
none
none
Sets a random pen shade value. See setpenshade
randpenshade
text
none
none
Sets a random text foreground non-black color
randomtextcolor
text
none
none
Sets a random text shade.
randomtextshade
movement and vectors
none
none
Orients the currently selected turtle randomly in three dimensions. This does NOT alter the current pitch, heading or roll values.
pendown repeat 10 [randomvectors fd 100 home]
words and lists
[startnumber endnumber (step)] (list)
list
Returns a list containing a range of numbers starting with startnumber and incrementing by one until and including endnumber, unless endnumber is less than one away from the current number. If the optional step value is included, range will step by that value, without overshooting. For an alternate method, see sequence
show range [1 10]
[1 2 3 4 5 6 7 8 9 10]
show range [0.5 10.25]
[0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5]
show range [1 10 3]
[1 4 7 10]
shapes and graphics
length
none
Creates a filled isosceles right angle triangle with two sides of the same specified length.
rat 20
shapes and graphics
width (number) | height (number)
none
Creates a pen-drawn rectangle of the specified width and height to the front and right of the current turtle.
rect 10 20
input and output
none
character
Reads a character from the keyboard buffer and returns it. If there is no key in the buffer, it will wait for the user to press a key. See keyp
show readchar
input and output
number
word
Reads the specified number of characters from the keyboard buffer and returns them as a single word. If there are insufficient keys in the buffer, readchars will wait for the user to press a sufficient quantity of keys to meet the required amount.
show readchars 5
environment
none
none
Forces the underlying Go language to run garbage collection. Garbage collection can cause a momentary pause intermittently. You can use recycle to time it better.
recycle
input and output
none
filename
Outputs the name of the current file open for reading. You can change the current read file with the setread primitive. reader returns an empty list if the current reader is the keyboard.
print reader
/myfile.txt
input and output
filename
list
Returns a list of ’long words’ (words with spaces), each long word in that list containing one line of the specified input file. You can use ‘parse’ to turn each long word into a list. See parse
show readfile "myfile.txt
input and output
none
list
Inputs a list from the keyboard OR currently open file. See question, readchar, setread
make "name readlist
input and output
none
number
Returns the current read position in the read file in bytes.
show readpos
environment
key (word)
value
Returns the value of the specified key in the sector of the selected zone currently inhabited by the calling turtle. See newzone, putsector
show readsector "key
input and output
none
word
Reads a ‘word’ from the keyboard or open file. As opposed to readlist, this input is returned as a word, or a ’long word’ if it includes spaces. See readlist, setread
make "input readword
input and output
none
none
Redo reverts the library of procedures in the current turtleSpace to those contained in the next (forwardly) available autosave - it redoes those changes. Hence it is only available after using undo. See undo for a better explanation.
redo
turtles
none
none
Erases all turtles except for Myrtle, Snappy and Libby, and any turtles that have defined procedures.
release
list
none
Short for remark, rem simply takes a list of text for the purposes of commenting. However, unlike comments created with semicolons, you can follow a rem with additional instructions on the same line. You can also retrieve the last ’executed’ rem by viewing lastrem, which makes remarks useful for debugging, and removes the need to fill the text display with debug print output. See lastrem.
rem [This is a remark]
rem {|The value of "var is| :var}
words and lists
operation (word) | input (word or list)
output
invokes a combining function to join the members of an aggregate. Reduce takes two inputs. The first must be the name of a two-input operation; the second can be any word or list.
show reduce "word [C S L S]
CSLS
show reduce "sentence "UNICEF
[U N I C E F]
mathematics
numerator (number) | denominator (number)
integer (number)
Returns the integer remainder of the division of the numerator by the denominator. The numerator and denominator are converted to integers if they are not provided as integers. For floating-point calculations, use mod
show remainder 22 7
1
words and lists
index (number) | word or list
word or list
Returns a word or list without the specified character or list item.
show remove 2 [pig duck frog]
[pig frog]
print remove 4 "frog
fro
containers
name | property
none
Removes the given property from the named property list.
remprop "proplist "property
input and output
source | destination
none
Renames a file.
renamefile "oldname "newname
environment
source | destination
none
Renames a procedure.
renameproc "oldname "newname
turtles
oldname | newname
none
Renames a turtle.
renameturtle "fred "doug
containers
oldname | newname
Renames a container.
rename “oldname “newname
environment
none
none
Enables global (all turtles) rendering of 3D graphics. See norender, which turns it off.
render
boolean
none
boolean
Returns true if rendering is enabled. See render.
conditionals and flow
number
number
Returns the current iteration of a repeat loop at the specified level above the current repeat loop. For example, repabove 1 returns the repcount value of the repeat loop directly (one level) above the current repeat loop. If the repeat ‘scope’ specified by repabove does not exist, repabove returns 0. See repcount
show repabove 1
conditionals and flow
none
number
Returns the current iteration of a repeat loop. See repabove
repeat 10 [print repcount]
conditionals and flow
repetitions [list of requests to repeat]
none
Repeats the list of requests specified in square brackets the declared number of repetitions. See repcount
repeat 4 [forward 10 right 90]
words and lists
index list value
list
Replaces the item at the specified index in the provided list with the provided value.
make "dogs replace 3 [doberman pug siamese] "chihuahua
tables
name (word) | list of cell contents (list)
none
Replaces a column in the named table with the provided list of cells.
replacecolumn "table [1 2 3 4 5 6 7]
tables
name (word) | list of cell contents (list)
none
Replaces a row in the named table with the provided list of cells.
replacerow "table [1 2 3 4 5 6 7]
tables
name (word) | list of table contents (list)
none
Replaces the contents of a table with the provided list of cells. See table
replacerow "table [[1 2 3] [1 2 3] [1 2 3]]
shapes and graphics
name (word) | list
none
Replaces the contents of the named tag with the contents of the provided list of turtle primitives.
replacetag "mytag [FD 20 RT 90 FD 20 RT 90]
control
turtle [list of instructions]
none
Performs the provided series of instructions once the specified turtle has no other workers executing. See interrupt for a more abrupt way of doing this
request "myrtle [sphere 50]
none
none
Resets the random number generator to the state ‘seeded’ at initialization (caused by restart, initialize or loading a turtleSpace). This causes a replication of the series of numbers generated by random.
rerandom
environment
none
none
Clears the environment, erases all containers, halts all workers, returns all turtles to their home positions in all spaces. See resetspace
reset
control
none
none
Resets the current turtle’s age. See age
resetage
shapes and graphics
none
none
Resets the turtle’s model to its default.
resetmodel
environment
none
none
Resets only the turtles in the current space, and space-specific parameters such as the background color.
resetspace
text
none
none
Resets the text layer to 60 columns, white on black, text size 1, default font.
resettext
environment
none
none
Resets the system timer to zero.
resettime
environment
none
none
Restarts turtleSpaces.
restart
environment
none
none
Restores a maximized window. See maximize
restore
text
none
none
Restores the last text screen saved to the “stack”. If there are multiple savetexts, they can be progressively restored by using multiple restoretexts. See savetext
restoretext
control
worker (number) or workers (list)
none
Resumes execution of the specified worker(s). See suspend, newworker
resume 7
sound and music
none
none
Resumes paused music playback.
resumemusic
words and lists
word, number or list
word, number or list
Reverses the order of the provided word, number or list.
print reverse 123
321
print reverse "duck
ckud
show reverse [pig duck frog cow]
[cow frog duck pig]
input and output
none
none
Reverts to the last formal save, for example if you load a turtleSpace and muck about with it, but want to quickly return it to its original state.
revert
shapes and graphics
width (number) | height (number)
none
Creates a 2D rhombus of the specified width and height.
rhombus 30 10
movement and vectors
degrees
none
Turns the selected turtle the specified number of degrees to the right. If the specified number of degrees is negative, turns it to the left. See left
right 90
words and lists
none
]
Returns a right bracket. Useful for times when turtleSpaces does not allow you to use a right bracket in isolation.
print rightbracket
]
movement and vectors
none
vector
Returns the right vector of the selected turtle.
show rightdir
text
none
none
Right-justifies text output using print. See leftjustify
rightjustify
shapes and graphics
thickness (number) | inner radius (number) | segments (number)
none
Creates a two-dimensional ring of the specified thickness, inner radius and segments. A segment number of 4 creates a square picture frame, while 3 creates a triangle. See ringarc
ring 10 30 10
shapes and graphics
thickness (number) | inner radius (number) | totalsegments (number) | arcsegments (number)
none
Creates a partial ring of the specified number of segments. So, if the totalsegments specified were 10, an arcsegments value of 5 would create a half-ring.
ringarc 10 30 10 5
movement and vectors
none
number
Returns the current roll value. See setroll
show roll
movement and vectors
degrees (number)
none
Rolls the currently selected turtle to the left by the provided number of degrees.
rollleft 90
movement and vectors
degrees (number)
none
Rolls the currently selected turtle to the right by the provided number of degrees.
rollright 45
shapes and graphics
length (number)
none
Draws a ‘rope’, a cylinder of the specified length, and places the turtle at its end, similar to mark or forward. You can set the diameter of the rope with setropewidth, and the number of sides the rope has using setropesides. See ropesides, ropewidth
rope 10
shapes and graphics
none
number
Returns the number of sides of the cylinder drawn by rope. See setropesides
show ropesides
shapes and graphics
none
number
Returns the current width or radius of the rope. See setropewidth
show ropewidth
words and lists
index (number) | word or list
Makes index the first item in the output, followed by the remaining items after it in the input, then the items before it, starting with the first.
show rotate 5 [1 2 3 4 5 6 7 8 9]
[5 6 7 8 9 1 2 3 4]
show rotate 2 [pig duck frog]
[duck frog pig]
show rotate 4 "piglet
"letpig
mathematics
number
number
Takes a number and returns it rounded to the nearest whole number, up or down (whichever is closer).
print round 4.6
5
print round 1.2
1
tables
tablename | row
list
Returns the entire specified row of the specified table, formatted as a list. See column=
show row "mytable 5
control
list
none
Executes the provided list of primitives. This allows you to use various word and list functions to dynamically generate turtleCode into a list which can then be executed.
make "square [repeat 4 [forward 20 right 90]]
run :square
control
list
none
Executes the provided list of primitives and procedures with primitives given precedence over procedures (the opposite of normal execution). For example, if you have a procedure named forward, it would ordinarily override attempts to execute the forward primitive. However, if you pass forward to runprimitive, runprimitive will execute the forward primitive in preference to your procedure. You can also accomplish the same effect as runprimitive by prefacing a primitive with @. See examples
runprimitive [forward 20]
@forward 20
shapes and graphics
image (word) | position (list)
RGBA (list)
Sample returns a list of the RGBA values of the pixel at the specified position (given in terms of percentages, measured from the bottom-left corner of the image) in the specified loaded image. For example, sample “frog [50 50] will return the color of the pixel located at 50% of frog’s height, and 50% of frog’s width. Sample can be used to determine the color of a pixel underneath a turtle, for example, by doing a bit of funky math.
show sample "frog [50 50]
input and output
none
none
Creates a save point in the current turtleSpace project.
save
shapes and graphics
image | filename
none
Saves an internally stored image. Useful for saving internally created or modified images.
saveimage "myimage "imagefile
shapes and graphics
modelname (word) | modelfile (word)
none
Saves the specified model name into the specified model file. See loadmodel
savemodel "mymodel "modelfile.mdl
input and output
filename (word)
Saves a screenshot into the specified filename.
savepict “mypic.png
input and output
procedure (word) | filename (word)
none
Saves the specified procedure into the specified file.
saveproc "myproc "myproc.to
input and output
filename (name) | plotname (name)
none
Saves the specified plot to the specified file. See plot
saveplot "myplotfile "myplot
tables
tablename (word) | filename (word)
none
Saves the specified table to disk using the specified filename.
savetable "mytable "mytable.tbl
shapes and graphics
tagname (word) | tagfile (word)
none
Saves the contents of the specified tag to the specified filename. See loadtag
savetag "mytag "tagfile
text
none
none
Saves the contents of the text screen to a “stack”, see restoretext
savetext
shapes and graphics
filename
none
Saves the calling turtle’s ’turtle track’ to a file.
savetrack
turtles
filename
none
Saves the calling turtle’s procedures to a file.
saveturtle
sound and music
word or list
none
Causes the operating systems speech-synthesis (if available) to speak the given word or list. Note that this may not be available on some systems, and should not be used as a primary means of communicating with the user.
say "hello
tables
table (word) | [column value (variance)] (list)
list
Searches a given column in the given table for the given value, within the optionally provided variance if numeric. See srow
show scol "table [4 6 2]
words and lists
searchmask (word) | list
list
Returns any items in the provided list that match the provided search mask, which can contain asterisks * which ‘wildcard’ the start or the end of the search mask (and return results that match any characters trailing or leading the search mask) or question marks ? that wildcard a single character. For example, fr* would match both free and frog, while f?r would match for and far.
show search "fr* [frog fred duck]
[frog fred]
boolean
searchmask (word) | list
boolean
Returns true if the specified search would return a result. See search
show searchp "pig [pig frog duck]
TRUE
words and lists
word, list or number
letter, word, list or number
Returns the second item in a word, list or number. See also first, third
print second 345
4
print second [dog pig duck]
pig
print second "frog
r
environment
none
seconds (number)
Returns the current seconds value from the system clock. See hours, minutes
show seconds
environment
none
list
Returns the available keys in the sector currently inhabited by the calling turtle. See newzone, putsector
show sectorkeys
shapes and graphics
name (word)
none
Selects the named plot for use with plot, unplot, plotcol. See plot
selectplot "myplot
environment
space (word)
none
Selects and moves the calling turtle to the given space. This space must have been first created with newspace. The turtle’s track moves with the turtle to the new space.
selectspace "innerspace
environment
name (word)
none
Selects the specified user as the current operating user.
selectuser "Bonnie
environment
name (word)
none
Selects a zone to read sectors from. See zones, newzone
selectzone "zone
words and lists
word | word
list
Creates a list from the given words. If brackets are placed around the sentence primitive and its inputs, it can take one or as many inputs as required.
make "var sentence "duck "pig
(show sentence "duck "pig "cow)
[duck pig cow]
mathematics
[from | to | count] (list)
list (list)
Similar to range but outputs a list of numbers starting with the first parameter, then takes a number of equally-spaced steps specified by the third parameter to reach the number given in the second parameter. See range
show sequence [1 10 6]
[1 2.5 4 5.5 7 8.5 10]
containers
surname | container | value
none
Sets the contents of the named container in the named surname to the provided value. See setsurname, surname, get
set "jones "car "camry
environment
word
none
Sets the description of the current turtleSpace. This is a ’long word’, a string bracketed by pipes |. It can also be edited in the ed editor.
setabout |This is my turtleSpace!|
turtles
RGBA (list)
none
Sets the ambient light values (red, green, blue, and opacity) of the calling turtle, if the turtle is acting as a light. See ambient
setambient [50 50 50 100]
movement and vectors
position
none
Sets the selected turtle’s orbit anchor to the specified three-dimensional position. Compare with fixate.
setanchor [0 0 0]
turtles
distance (number)
none
Sets the distance the turtle’s directional arrow is from the turtle’s position. See showarrow, hidearrow
setarrowdistance 10
turtles
size (number)
none
Sets the size of the turtle’s directional arrow. See showarrow, hidearrow
sound and music
number
none
Default is 0.3. When a sound is played, the distance between the emitter and receiver (view turtle) is multiplied by the attenuation value to calculate the resultant volume of the sound at the receiver. Basically this makes sounds quieter the farther away the view turtle is from the turtle making the sound. This is a global setting that affects all turtles. See attenuation, attenuate
setattenuation
word
none
Sets the system beep to the sound named by the provided word. See beep
setbeep “sheep
beep
environment
number
none
Sets the background color to the color index referenced by the provided number. Note that you can use the color names referenced in the colors primitive description, because they are actually functions which return the corresponding index number.
setbackgroundcolor 5
setbg yellow
environment
shade (number)
none
Sets the shade of the pen color to be displayed when rendering subsequent lines. It can be set to a number from 0 to 15, which represents a decrease in brightness of the pen color of 6.25 times that number. So, a value of 8 decreases the brightness by 50%.
setbackgroundshade 5
movement and vectors
x1 y1 x2 y2 (list)
none
Sets the boundary used by wrap and fence
setbounds [-100 -100 100 100]
text
column (number) | row (number)
none
Moves the text cursor to the specified column (x) and row (y).
setcursor 10 10
text
char (word)
none
Sets the text cursor to the provided character.
setcursorchar "X
turtles
RGBA
none
Sets the diffuse light RGBA values of the calling turtle, if that turtle is acting as a light. See diffuse
setdiffuse [50 50 50 100]
shapes and graphics
size (number)
none
Sets the calling turtle’s dot size. All of a turtle’s dots are of the same size, but different turtles can have different-sized dots. See dotsize, dot, dotp.
setdotsize 5
shapes and graphics
color (number)
none
Sets the ‘fill’ color used by the turtle when creating shapes.
setfillcolor 3
setfillcolor blue
shapes and graphics
shade (number)
none
Sets the shade of the fill color to be displayed when rendering subsequent shapes. It can be set to a number from 0 to 15, which represents a decrease in brightness of the fill color of 6.25 times that number. So, a value of 8 decreases the brightness by 50%. Negative shade values add 1/16th of the difference between each of the base RGB values of the color and 255
setfillshade 5
shapes and graphics
opacity (number)
none
Sets the fill opacity, takes a number from 0 to 100.
setfillopacity 50
turtles
angle (number)
none
Sets the angular increments by which the turtle turns when fluid mode is on. See fluid
setfluidangle 5
turtles
steps (number)
none
Sets the step increments by which the turtle moves when fluid mode is on. See fluid
setfluidstep 1
turtles
number
none
Sets the number of hatchlings that can be hatched every second.
sethatchlimit 100
movement and vectors
degrees (number)
none
Sets the turtle’s heading (left-right) and updates its orientation appropriately. Be aware that while setheading will alter the value of heading for the purposes of orientation, setorientation may not restore the expected turtle orientation if setheading is used in isolation. If you intend to use setorientation to restore a turtle’s orientation, you should use setorientation to change aspects of a turtle’s orientation also. See orientation
setheading 90
shapes and graphics
number
none
Sets the complexity of the icosphere, from 0 to 3
seticosphereiterations 3
sound and music
instrumentfile (word)
none
Loads an instrument file (saved from tracker) for use with playnotes. See tracker, playnotes
setinstrument "xylophone.snd
turtles
number
none
Sets the light status of the calling turtle to either 0 (not a light), 1 (spot light) or 2 (point light). See light
setlight 1
shapes and graphics
vector (list)
none
Sets the ’normal’ vector to be used by lightlines. All lines use the same vector. This is easiest taken from a turtle. Remember that if you take the forwarddir from Snappy, you will need to reverse it, using vectorsub! See lightlines
setlinesnormal vectorsub snappy:forwarddir [0 0 0]
shapes and graphics
radius (number)
none
Sets the width of the mark primitive. The default is 2. See mark
setmarkerwidth 10
turtles
modelname (word)
none
Sets the turtle model to the specified model name. See newmodel, setmodelscale Built-in models: myrtle, turtle, spaceship, astronaut, plane, invisible
setmodel "plane
turtles
ratio (number)
none
Scales the turtle’s model based on the given ratio.
setmodelscale 2
sound and music
speed (number)
none
Sets the speed of music playback.
setmusicspeed 128
sound and music
percent (number)
none
Sets the volume (amplitude) of music playback using a value from 0 to 100.
setmusicvolume 50
sound and music
number
none
Sets the music channel to be used to play back notes with playnotes
setnoteschannel 1
sound and music
speed (number)
none
Sets the speed of note playback.
setnotespeed 128
movement and vectors
turtle-units (number)
none
Sets the currently selected turtle’s distance from its anchor point.
setorbitdistance 100
movement and vectors
vectors (list)
none
First unwinds the current orientation in the reverse of orientationorder, then changes the calling turtle’s orientation in the order specified by orientationorder, so that if orientationorder is “PHR then the first orientation changed is pitch, then heading, then the roll. Due to the nature of 3D movements, setorientation can only be used to restore orientations that are the result of relatively simple transforms (that is, series of orientation changing commands such as rollright or down). To restore complex orientations, use both setorientation and setvectors. See setvectors
setorientation [0 90 0]
movement and vectors
order (word)
none
Sets the order in which heading, pitch and roll are processed after using setheading, setpitch or setroll. The required word is a three letter combination made up of h, for heading, p, for pitch, and r, for roll. See orientationorder
setorientationorder "hpr
setorientationorder "rhp
movement and vectors
[x y z] (list)
none
Sets the turtle’s origin, the location it goes when it goes home. See origin, home
setorigin [50 50 50]
shapes and graphics
name (word) | ratio (number)
none
Sets the resolution or pixel density of the named overlay, based on a ratio where 1 is 512 pixels by 384 pixels (at a 16:9 ratio)
setoverlayresolution "myrtlesview 2
shapes and graphics
name (word) | boolean
none
Turns on background transparency for the specified overlay. If transparency is off, the background color in the overlay view is solid.
setoverlaytransparency "myrtlesview on
shapes and graphics
name (word) | frames per second (number)
none
Sets the update frequency of the named overlay to the provided number of frames per second. See newoverlay
setoverlayupdate "myrtlesview 10
input and output
path (word)
none
Sets the current file path. Root / is the current user folder.
setpath "/
shapes and graphics
color (number)
none
Sets the pen color to the provided color index. Note that there are a number of color functions that return their corresponding numbers, such as yellow and blue, that can be used in place of a number. See colors
setpencolor yellow
setpc 13
shapes and graphics
shade (number)
none
Sets the shade of the pen color to be displayed when rendering subsequent lines. It can be set to a number from 0 to 15, which represents a decrease in brightness of the pen color of 6.25 times that number. So, a value of 8 decreases the brightness by 50%.
setpenshade 5
number
none
Sets the pen’s opacity. Takes a number from 0 to 100.
setpenopacity 50
number
none
Sets the width of the pen. In turtleSpaces, this sets the pen width globally, that is the setting applies both to lines already drawn and subsequently drawn lines. If you want to draw lines of varying widths, use mark
setpenwidth 5
movement and vectors
degrees (number)
none
Sets the turtle’s pitch (up-down) and updates its orientation appropriately. Be aware that while setpitch will alter the value of pitch for the purposes of orientation, setorientation may not restore the expected turtle orientation if setpitch is used in isolation. If you intend to use setorientation to restore a turtle’s orientation, you should use setorientation to change aspects of a turtle’s orientation also. See orientation
setpitch 180
movement and vectors
[x y] (list)
none
Sets the x and y co-ordinates of the calling turtle’s position. If the pen is down, a line is drawn between the turtle’s old position and new position. Does not affect z. Exists for compatibility with two-dimensional logos.
setpos [20 30]
movement and vectors
[x y z] (list)
none
Sets the turtle’s co-ordinates. If the pen is down, a line is drawn between the turtle’s old position and its new position.
pendown repeat 100 [setposition {-200 + random 400 -200 + random 400 -200 + random 400}]
input and output
path
none
Sets the path for file operations. / is always the root of the user’s folder
setprefix "/
turtles
instructions [list]
none
Allows you to insert instructions between the end of the turtle track and the start of the model. Mostly used to alter the orientation of the model, for example to point the turtle upwards when orbiting a point, rather than pointing at the point, as in the startup animation, or to rotate the model without affecting its logical orientation.
setpremodel [up 90]
input and output
filename (word)
none
Sets a file previously opened with ‘open’ to be read from using readchar, readchars, readword or readlist. See open, close, setreadpos, setwrite
setread "inputfile
input and output
bytes (number)
none
Sets the read position of the current ‘reader’ (the input file set using setread). The provided number must be between 0 and the length of the file.
setreadpos 100
movement and vectors
degrees (number)
none
Sets the turtle’s roll (rollleft-rollright) and updates its orientation appropriately. Be aware that while setroll will alter the value of roll for the purposes of orientation, setorientation may not restore the expected turtle orientation if setroll is used in isolation. If you intend to use setorientation to restore a turtle’s orientation, you should use setorientation to change aspects of a turtle’s orientation also. See orientation
setroll 90
shapes and graphics
sides (number)
none
Sets the number of sides of the cylinder created by the rope primitive. The default is 10. See rope, ropesides
setropesides 3
shapes and graphics
number
none
Sets the radius of the ‘rope’. See rope, ropewidth, ropesides
tables
table (word) | sheet (number)
none
Sets the ‘sheet’ (third dimension) used by the table commands srow, scol, replacerow, replacecolumn, row and column
setsheet "table 2
sound and music
volume (number)
none
Sets the volume of digital and analog sound playback using a range of 0 to 100, where 0 is off and 100 is full. This is turtle-specific. See setmusicvolume
setsoundvolume 50
shapes and graphics
list
none
Takes a list of colors to be used in the generation of speckle patterns. If you want to weight a random speckle towards a particular color, simply include it more than once in the request, such as the example below.
setspecklecolors [1 1 1 1 2 2 3]
setspecklecolors {:col1 :col1 :col2}
shapes and graphics
plotname (word)
none
Selects the name of the plot to use to generate a speckle, if using the plot style with speckle.
setspeckleplot "myplot
shapes and graphics
turtleSteps
none
Sets the pixel size used in generating speckles, in turtleSteps.
setspecklesize 1
shapes and graphics
“styletype
none
Selects the style to use when generating speckles. You can choose from “repeat “dither “random or “plot.
setspecklestyle "random
turtles
RGBA (list)
none
Sets the specular RGBA values of the calling turtle, if the turtle is acting as a light. See specular
setspecular [50 50 50 100]
turtles
microseconds (mumber)
none
Sets the number of microseconds the turtle sleeps between executing each instruction, an instruction being a fully formed statement, such as print position, or right sum 20 30. The default is 500 (half of a millisecond). Note that if you set this to a low value, or 0, you may use a large percentage of your host computer’s available CPU time, and may cause issues with your operating system’s overall performance! See speed
setspeed 200
shapes and graphics
boolean
none
Sets the axis by which spheroids are stretched. 0 is equatorial while 1 is polar. See spheroidaxis
setspheroidaxis 1
turtles
number
none
Sets the spot light cutoff value of the calling turtle, if that turtle is a light. See spotcutoff
setspotcutoff 1
turtles
number
none
Sets the spot light exponent value of the calling turtle, if that turtle is a light. See spotexp
setspotexp 0
sound and music
number
none
Sets the ‘squelch’ value, sounds with a(n attenuated) volume under that specified value will not be sent to the audio engine for processing (they will not play.) There are a limited number of audio channels for sounds, and squelch will prevent them from being filled up with barely audible sounds. Squelch is a global setting that affects all turtles in all spaces. See squelch
setsquelch 50
“surname
none
Used to select the ‘surname’, otherwise more commonly known as the ‘container space’, to use. All the containers (or variables) in turtleSpace have a surname, or family they belong to. Changing the surname allows you to use code containing single-dimension containers in different contexts (for example, different players) without having to modify it. You just set a different surname and run the code again. The default surname is “default
setsurname “player1
make "score 5
setsurname "player2
make "score 10
setsurname "player1
print :score
5
turtles
state (list)
none
Sets the turtle’s state. See state
setstate snappy:state
text
color (number)
none
Sets the text background color to the provided number.
settextbackground 5
settextbackground yellow
text
foregroundcolor (number) | backgroundcolor (number)
none
Sets the text color. Requires both foreground and background text colors to be specified. See settextforeground and settextbackground
settextcolor [2 15]
text
font-id
none
Sets the text font, based on a font-id number. 0 is the default high-resolution font. 1 is the Apple II system font. 2 - 5 are stylised low-resolution fonts (fantasy, computer, sci-fi)
settextfont 1
text
color (number)
none
Sets the text foreground color to the provided number.
settextforeground 2
settextforeground blue
text
number
none
Sets the ‘shade’ or brightness of the text color. settextshade can take a value from 0 (normal) to 15 (darkest). Negative values are not valid for settextshade. Affects both foreground and background. Note that the prompt resets the text shade and so its effect will not be obvious if you simply enter it at the prompt!
settextshade 10
text
size (number)
none
Sets the text size, where 0 is the smallest text size.
settextsize 1
text
x1 y1 x2 y2 (list)
none
Sets the area of the text screen to write in. Note that the parameters are based on a 100 by 48 column screen, regardless of current text size.
settextwindow [10 10 70 30]
input and output
name (word)
none
Sets the title of the current turtlespace. Renames the current untitled turtlespace folder or changes the title of the currently open workspace folder. To create a new turtlespace, see initialize
settitle "MyGame
turtles
turtlename (word)
none
Sets the turtle to execute as to the provided turtlename. Shortcut is tu
setturtle myrtle
tu snappy
shapes and graphics
60ths-of-a-second (number)
none
Sets a delay between the rendering of each letter rendered by ’typeset’. This delay is specified in 60ths of a second - 60 equalling one second. See typeset
settypedelay 60
shapes and graphics
turtle-units (number)
none
Sets the depth of three-dimensional type created by ’typeset’. See typeset
settypedepth 3
shapes and graphics
font-id (number)
none
Sets the font used for ’typeset’. Default is 1. See settextfont
settypefont 1
shapes and graphics
boolean
none
If set true (default), typeset and inscribe create ‘filled’ characters. If false, they create lined cube characters.
settypefilled false
shapes and graphics
size (number)
none
Sets the size (in turtle units) of the font used by typeset and inscribe. See typeset
settypesize 10
shapes and graphics
ratio
none
Stetches text rendered using typeset or inscribe by the specified ratio.
settypestretch 2
containers
turtle (word) | container (word) | value (word, number, list or boolean)
none
Changes the contents of the container held by the specified turtle to the specified value. Technically bad form, but sometimes necessary.
setvar "myrtle "container 50
movement and vectors
[[forwarddir] [updir] [rightdir]] (list of lists)
none
Sets the current turtle’s orientation using vectors.
setvectors [1 -1 0] [1 1 1] [0 0 0]
shapes and graphics
turtle (word)
none
Sets the current “view turtle” - the turtle from whose viewpoint the display is generated.
setview "myrtle
shapes and graphics
distance (number)
none
Sets the far clipping plane, the distance at which OpenGL objects stop being rendered or are clipped. This must be set by the view turtle. See setviewnear
setviewfar 1000
shapes and graphics
angle (number)
none
Sets the turtle’s viewing angle, the angle of view displayed in the window. The default is 60
setviewfov 60
shapes and graphics
distance (number)
none
Sets the near clipping plane. OpenGL objects closer than this distance are not rendered or are clipped. This must be set by the view turtle. See setviewfar
shapes and graphics
list
none
Positions the view by the provided [X (left-right) Y (down-up) Z (back-forward)] list of turtle units, where a negative value has the first effect and a positive value has the second effect.
setviewpoint [10 -10 0]
sound and music
volume (number)
none
Sets the overall volume level, taking a value from 0 (off) to 100 (full).
setvolume 50
text
columns (number)
none
Sets the width of the text screen in columns. Valid values are 40, 50, 60, 80 and 100.
setwidth 60
input and output
filename (word)
none
Sets the previously ‘open’ed file for writing. See open, close, setread
setwrite "file
input and ouput
byte (number)
none
Sets the write position in the currently opened file. See setwrite
setwritepos 60
movement and vectors
number
none
Sets the turtle’s x position.
setx 100
movement and vectors
x (number) | y (number)
none
Sets the turtle’s x and y co-ordinates. This is here for compatibility. As opposed to setpos, which takes the two co-ordinates as a list. See setpos
setxy 10 20
movement and vectors
number
none
Sets the turtle’s y position.
sety 20
movement and vectors
number
none
Sets the turtle’s z position.
setz 50
shapes and graphics
percentage (number)
none
Sets the view turtle’s camera ‘zoom’ - the default is 100%
setzoom 50
shapes and graphics
depth (number)
none
Creates a ‘shard’ or a three-dimensional fragment using the current and two previous turtle positions with a depth specified by its input parameter.
shard 10
“name
none
Indicates that the container “name should be shared amongst all turtles.
share “lives
none
list
Returns a list of all the currently shared containers.
show shares
booleans
“sharename
boolean
Returns true if the specified “sharename exists.
show sharep "sharename
tables
table (word)
sheet (number)
Returns the current sheet number for the given table. See setsheet
show sheet "table
words and lists
list
number
Returns the item number of the first shortest item in the list by number of characters or digits. See count
print shortest [pig duck cow]
1
print shortest [1000 100 10]
3
text
input
none
Prints the supplied input to the screen (or file if setwrite is enabled), with brackets around lists, if appropriate, followed by a carriage return. Compare with print, type
show [duck pig]
[duck pig]
turtles
none
none
Shows all turtles. See hideall
showall
environment
none
none
Shows the location of the turtle’s anchor with a red ball. See hideanchor, anchor
showanchor
turtles
none
none
Shows the directional arrow, which indicates the direction the turtle is facing. See hidearrow, setarrowsize, setarrowdistance
showarrow
text
none
none
Shows a colored list of built-in colors. The following colors have named primitives that return their numerical value (eg black returns 0):
black
red
blue
magenta
green
grey
mediumblue
lightblue
brown
orange
lightgrey
pink
lightgreen
yellow
cyan
white
setfillcolor red
setpencolor blue
text
none
none
Shows the text cursor.
showcursor
movement and vectors
turtle
none
Causes the calling turtle to position itself in the default view turtle position over the specified turtle. Usually called by the current view (camera) turtle.
showme "myrtle
environment
none
none
Shows the mouse cursor. See hidemouse
showmouse
boolean
none
boolean
Returns true if the turtle is not hidden, false if it is.
show shownp
TRUE
shapes and graphics
name (word)
none
Shows the specified overlay. See newoverlay
showoverlay "myrtlesview
shapes and graphics
plotname (word)
none
Shows (all) the named plot(s). If you want to show / hide one specific instance of a placed plot (since you can place multiple), place them inside of a tag. See tag, hideplot, plot
showplot "myplot
shapes and graphics
name (word)
none
Shows the sticker with the provided name. See placesticker
show "marquee
shapes and graphics
tag (word)
none
Shows (makes visible) the specified tag. See tag
showtag "mytag
shapes and graphics
none
none
Shows the calling turtles ’turtle track’ or visible output. See hidetrack
showtrack
none
Causes the turtle to display if hidden.
showturtle
degrees
Returns the sine of degrees.
print sin 90
words and lists
list
list
Randomly re-orders contents of provided list.
show shuffle [1 2 3 4 5]
[3 1 5 4 2]
show shuffle [frog duck pig]
[pig frog duck]
turtlename
Returns the number of milliseconds since the turtle added to its track, by moving, creating an object or changing a turtle parameter such as the pen color.
print myrtle:sinceactive
control
milliseconds
none
Causes execution to pause for the specified number of milliseconds. Useful when working with time to calculate delays. Alternative to wait.
sleep 1000
movement and vectors
turtle-steps
none
‘Slides’ the turtle to the left the given number of turtle-steps.
slideleft 20
movement and vectors
turtle-steps
none
‘Slides’ the turtle to the right the given number of turtle-steps.
slideright 30
words and lists
list
number
Returns the numerically smallest item in the provided list.
show smallest [10 100 1000]
1
input and output
imagename (word)
none
Takes a snapshot of the screen and places it into the internal image library with the given imagename. That image can then be used with ‘sample’ to provide basic 2D collision detection, or used on a ‘billboard’. See listimages, sample, billboard
snapshot "screenshot
turtles
none
“snappy
Snappy is the default ‘view’ turtle, one of the three turtles created when a space is initialized, and the first turtle from whose perspective you see when you start up turtleSpaces. While other turtles (except for Libby) can both create things and be seen out from, Snappy can only move and be used as a view turtle, and cannot create items in his ’turtle track’ (eg create lines or shapes). See myrtle, libby
setview snappy
control
none
none
Stops all threads running in the calling turtle except the thread executing solo, if that thread belongs to that turtle.
solo
tables
tablename (word) | column (number)
none
Sorts the specified table on the given column, low to high.
sort "table 3
boolean
soundname (word)
boolean
Returns true if the specified sound is loaded in memory.
show soundp "mysound
environment
none
word
Returns the current space.
show space
boolean
word
boolean
Returns true if the specified space is defined.
show spacep "home
true
sound and music
none
number
Returns the current sound volume.
show soundvolume
environment
none
list
Returns a list of the currently defined spaces
show spaces
shapes and graphics
none
none
Enables ‘speckling’ (generated pixelated texturing) of any following square, quad, voxel and voxeloid shapes. These are configured using setspecklestyle (repeat, random or plot), setspecklecolors, setspecklesize and optionally setspeckleplot. nospeckle disables speckling
speckle
shapes and graphics
none
list
Returns the currently defined speckle colors. See speckle
show specklecolors
boolean
none
boolean
Returns true if speckle is enabled. See speckle
show specklep
shapes and graphics
none
word
Returns the plot currently used by speckle in the plot style. See setspecklestyle
show speckleplot
shaoes and graphics
none
number
Returns the currently defined speckle size. See setspecklesize, speckle
show specklesize
shapes and graphics
none
word
Returns the current speckle style. See speckle
show specklestyle
"random
turtles
none
none
Returns the specular RGBA values of the calling turtle, if that turtle is acting as a light. See setspecular
show specular
turtles
none
microseconds (number)
Returns the current speed value, the number of microseconds the turtle ‘sleeps’ between the execution of each instruction. The default speed value is 500 microseconds, or half a millisecond. See setspeed
show speed
shapes and graphics
radius (number) | stacks (number) | sectors (number)
none
Creates a sphere of the specified radius using the specified number of stacks and the specified number of sectors. Small stack and sector values create interesting shapes. As opposed to icosphere
sphere 20 10 10
shapes and graphics
radius (number) | stacks (number) | sectorstotal (number) | sectorsused (number)
none
Creates a partial sphere of the overall specified radius, using the specified number of vertical ‘stacks’, and specified number of horizontal ‘sectors’, based on the given total number of sectors, and the used (displayed) number of sectors. Like an orange cut vertically. See cutsphere, cutsphereslice
sphereslice 20 10 10 5
shapes and graphics
radius (number) | stacks (number) | sectors (number) | multiplier (number)
none
Creates an spheroid of a specified radius, stacks and sectors, stretched using the provided multiplier.
sphereoid 20 10 10 2
shapes and graphics
none
boolean
Returns the current spheroid axis, the axis along which spheroids are stretched. 0 is equatorial and 1 is polar.
show spheroidaxis
shapes and graphics
radius (number) | stacks (number) | sectorstotal (number) | sectorsused (number) | multiplier (number)
none
Creates a partial spheroid of the overall specified radius, using the specified number of vertical ‘stacks’, and specified number of horizontal ‘sectors’, based on the given total number of sectors, and the used (displayed) number of sectors, and stretched using the provided multiplier. Like a squashed orange cut vertically. See cutspheroid, cutspheroidslice
spheroidslice 20 10 10 5 2
text
none
none
Displays the bottom 4 (in 24 line mode, 8 in 48 line mode, 2 in 12 line mode) lines of the text screen superimposed on the full graphics camera image. This is the default when turtleSpaces starts up. See fullscreen (no text), textscreen (only text), overlayscreen (full text overlaid on graphics)
splitscreen
shapes and graphics
radius (number)
none
Creates a filled circle of the specified radius.
spot 50
turtles
none
number
Returns the spot cutoff value of the calling turtle, if that turtle is a light. See setspotcutoff
show spotcutoff
turtles
none
number
Returns the spot exponent value of the calling turtle, if that turtle is a light. See setspotexp
show spotexp
mathematics
number
number
Returns the square root of the provided number.
show sqrt 16
4
shapes and graphics
size (number)
none
Creates a filled square of the specified size.
square 20
sound and music
none
number
Returns the ‘squelch’ value, the volume level sounds under which are not played. See setsquelch
show squelch
tables
table (word) | [row value (variance)] (list)
list
Searches a given row in the given table for the given value, within the optionally provided variance if numeric. See scol
show srow "table [4 6 2]
shapes and graphics
modelname (word)
none
‘Stamps’ a copy of the specified model at the current location using the current model scale.
cs pu repeat 20 [setmodelscale repcount / 10 stamp "plane fd 3 * repcount]
developer
none
none
STACK shows the current stack at the terminal.
TYPE stack in interactive mode and you'll get:
2020/05/10 08:44:38 Stack trace:
2020/05/10 08:44:38 0 : frog (line 2, stmt 1): [stack]
2020/05/10 08:44:38 1 : __immediate.0 (line 1, stmt 1): [frog 20]
It's really to help us debug execution of instructions.
turtles
none
list
Returns a list containing the entire turtle state. See setstate
show state
movement and vectors
none
none
Causes the calling turtle not to appear in lists returned by near. See nostealth
stealth
boolean
none
boolean
Returns true if the calling turtle is in stealth. See stealth, nostealth
show stealthp
environment
word or list
none
When procedures marked by the step primitive start execution, turtleSpaces pauses after execution of each statement.
CR processes next command and PRINTS it to text screen.
S resumes execution until thread leaves current scope (does not print debug during that time).
I executes until thread steps in to a scope.
O executes until the thread enters another TO, then pauses.
E executes until the thread exits a TO, then pauses
Q stops execution entirely
R resumes execution without stepping
N prompts for a "name and then shows the value of that name each step eg "name "value -- typing N and then entering an already monitored name disables monitoring that name. After doing an N STEP returns to the prompt without advancing
Use unstep to unmark procedures from stepping.
boolean
none
boolean
Returns true if the specified sticker is defined. See newsticker
show stickerp
shapes and graphics
none
list
Returns the currently defined stickers. See newsticker
show stickers
control
none
none
Stops execution inside the current procedure and returns to the level above, if it exists, or stops execution of the thread entirely.
stop
sound and music
none
none
Stops music playback. See playmusic
stopmusic
sound and music
none
none
Stops any sounds currently being played by the calling turtle, including loopsound. See playsound, loopsound
stopsound
mathematics
number1 (number) | number2 (number)
result (number)
Sums (adds) the two provided numbers.
show sum 2 2
4
containers
none
namespace (word)
Returns the surname of the current container (name) space. The default surname is ‘default’. See setsurname.
print surname
default
control
worker (number) or workers (list)
none
Suspends execution of the specified worker(s). See resume, newworker
suspend 7
boolean
workerid
boolean
Returns true if the specified worker is suspended. See suspend, resume
show suspendp 12
containers
container1 (word) | container2 (word)
none
Exchanges the contents of two containers. Note that the name of the container is specified as a word, eg “container. See make
swap "container1 "container2
conditionals and flow
containername (word)
none
Switch sets up the specified container to be tested using subsequent case primitives. Note: the container name for switch is ‘absolute’, that is, prefaced with a double quote “. If you specify a container using a colon : the container used by switch will be the container named by the container specified with a colon!
switch "var
shapes and graphics
tag1 (word) | tag2 (word)
none
Hides tag1 and shows tag2, like flipping a switch. See tag
switchtag "tag1 "tag2
control
none
none
Causes turtle to wait until all other turtles in its ‘family’ (siblings, parents, hatchlings) also call sync, or if any of them call a nosync. Commonly used to synchronise multithreaded hordes of game objects, such as enemies. See syncp, nosync, marco
ht repeat 20 [hatch [forever [randomvectors fd 10 sync]]] forever [until syncp [wait 60] sync]
boolean
none
boolean
Returns true if the calling turtle’s ‘family’ currently has an active sync. See sync
if syncp [sync]
tables
name (word)
list
Returns the contents of the named table as a list.
show table "mytable
tables
none
none
Returns a list of the currently defined tables.
show tables
tables
name (word)
list
Returns a list of the dimensions of the named table.
show tablesize "mytable
boolean
name (word)
boolean
Returns true if the named table is defined.
show tablep "mytable
shapes and graphics
name (word)
list
Returns the contents of a tag, as a list of turtle primitives. See begintag
show tag "mytag
boolean
tagname (word)
boolean
Returns true if the provided tag name is presently defined. See tag
show tagp "tag
shapes and graphics
none
list
Returns a list of the current turtle’s defined tags.
show tags
boolean
tagname (word)
boolean
Returns true if the tag with the provided tagname is currently visible (shown). See tag
show tagshownp "tag
input and output
none
none
Takes a cover photo, which is displayed in the file catalog when a turtleSpace is selected. If no cover photo exists, the file catalog displays the most recent auto-created snapshot (created when save is called). See save
takecover
mathematics
number
number
Returns the tangent of the supplied number. See arctan
print tan 5
0.087489
turtles
target (word)
none
keeps calling turtle in the same relative position (based on the orientation) of the target turtle as when tandem was called (for example, if the target moves, or rotates). If the calling turtle changes position using FD, etc., its relative position for the purposes of tandem is updated. tandem does not update the orientation of the calling turtle, only its position. notandem turns it off
tandem "myrtle
turtles
none
turtle (word)
Returns the name of the turtle the calling turtle is tandeming, if any. See tandem
show tandeming
boolean
none
boolean
Returns true if the calling turtle is tandeming another turtle. See tandem
show tandemp
turtles
turtle (word)
none
Causes the calling turtle to face the specified target turtle. A turtle may only target one turtle at a time. notarget turns it off. See notarget
target "myrtle
turtles
none
turtle (word)
Returns the name of the turtle the calling turtle is targeting, if any. See target
show targeting
boolean
none
boolean
Returns true if the calling turtle is targeting another turtle. See target
show targetp
turtles
turtle (word) or turtles (list) | message (number, word or list)
none
Sends a message to the target turtle containing the provided number, word or list. See listen
tell snappy "hello
shapes and graphics
half-width (number) | height (number) | depth (number)
none
Creates an opaque (solid) prism to the left, right and front of the turtle.
tent 10 10 5
conditionals and flow
expression
none
Evaluates the provided expression and then holds a boolean result for use with iftrue and iffalse.
test :a > 5
movement and vectors
none
none
Tethers the selected turtle to the orbit anchor point. If the turtle moves, the anchor point remains unchanged. See setanchor, notether
tether
boolean
none
boolean
Returns true if the calling turtle is tethering. See tether
show tetherp
shapes and graphics
size (number)
none
Creates a tetrahedron (4-sided shape) of the specified size.
tetrahedron 5
shapes and graphics
size (number) | ratio (number)
none
Creates a tetrahedroid (4-sided shape) of the specified size and stretched using the specified ratio.
tetrahedroid 5 2
tetrahedroid 10 0.5
environment
name (word)
list
Returns the contents of the provided procedure name as a list. See define
to square
repeat 4 [fd 10 rt 90]
end
show text "square
[[] [repeat 4 [fd 10 rt 90]]]
text
none
number
Returns the current text background color. See settextbackground
show textbackground
text
none
list
Returns the current text colors (foreground and background) as a list. See settextcolor
show textcolor
text
none
number
Returns the index of the current text font. See settextfont
show textfont
text
none
number
Returns the current text foreground color. See settextforeground
show textforeground
environment
none
none
Turns off the graphics rendering and displays only fullscreen text.
textscreen
text
none
number
Returns the current text size. See settextsize
show textsize
text
none
number
Returns the current textshade value.
show textshade
text
none
list
Returns the current dimensions of the text window.
show textwindow
containers
containername (word)
output
Returns the contents of (the ’thing’ in) the container of the provided container name. A longhand way of invoking the shortcut :container
show thing in "mycontainer
make "mycontainer thing in "mycontainer + 5
words and lists
word, list or number
letter, word, list or number
Returns the third item in a word, list or number. Lists of three things (co-ordinates, vectors) are common in turtleSpaces and first, second, third are more elegant than item 1, item 2, item 3. If you want fourth, fifth etc, you can create your own procedures for them! That is the beauty of Logo. See also first, second
print third 345
5
print third [dog pig duck]
duck
print third "frog
o
conditionals and flow
target (name)
none
Diverts execution to the first statement after the target catch statement. Chiefly useful for returning to the procedure / level the catch was called from when several levels deep into subprocedures or other procedures, as label / go only work inside the same procedure. Providing “toplevel as a target effectively halts execution, as toplevel is the interactive prompt. See also catch, label, go
TO test
catch "cow [duck]
pr "moo
END
TO duck
pr "quack
frog
END
TO frog
pr "ribbit
throw "cow
END
none
milliseconds
Ouputs the number of milliseconds since turtleSpace was started, or resettime was called. See resettime.
print time
input and output
none
title (word)
Returns the title (filename) of the current turtleSpace.
show title
name (:parameter1 :parameter2 …)
none
Declares that the user wishes to enter a procedure with the specified name. Can be optionally followed by any number of parameters, each starting with a colon. Each parameter must be specified when the procedure is executed, and these parameters become local containers (or variables) with the name of the parameter specified in the to, containing the value passed to the parameter when the procedure is executed. After return is pressed, the prompt turns into a > to indicate a procedure is being entered. Once you have entered the procedure, type end and press return to finish it. See edit
to square :size
repeat 4 [forward :size right 90]
end
square 40
sound and music
frequency (number) | duration (number)
none
none
Toot generates a tone of the provided frequency (specified in Hertz) and duration (in 60ths of a second). The alias 'tone' is included for compatibility with other Logos.
to siren :freq
if :freq > 440 [stop]
toot :freq 3
siren :freq + 5
toot :freq 3
end
shapes and graphics
thickness (number) | radius (number) | sides (number) | segments (number) | ratio (number)
none
Creates a torusoid, an extruded three-dimensional ring, stretched by a ratio where 1 is a normal torus.
torus 10 30 4 16 0.5
shapes and graphics
thickness (number) | radius (number) | sides (number) | totalsegments (number) | startsides (number) | endsides (number)
none
Creates a ‘slice’ of a torus, based on the startsides and endsides value. Note that using a negative thickness value inverts the slice.
torusslice 5 15 20 20 10 15
torusslice -5 15 20 20 10 15
shapes and graphics
thickness (number) | radius (number) | sides (number) | segments (number)
none
Creates a torus, also known as a rhombus or a donut, a three-dimensional ring. Sides and segments can be as low as 3.
torus 10 30 4 16
movement and vectors
[x y] (list)
heading (number)
Returns a heading that would make the turtle face toward the provided co-ordinates. towards assumes the target co-ordinate is on the same Z plane as the turtle. towards is a legacy Apple Logo primitive that is useful in turtleSpaces for compatibility and two-dimensional applications. See heading
setheading towards [30 40]
environment
list
none
The TRACE command takes a list of procedures as input and causes them to print tracing information when executed. It does not interrupt the execution of the procedure, but allows you to see the depth of the procedure in the stack. See untrace
trace [myproc]
shapes and graphics
none
none
Allows the calling turtle’s track to be created. See notrack
track
shapes and graphics
none
number
Returns the number of items in the current turtle’s track.
show trackcount
shapes and graphics
number
list
Returns the number last track item in the selected turtle’s track, where 1 returns the latest track entry
show trackitem 1
shapes and graphics
number
list
Returns the last number latest track items in forward chronological order, the first being the oldest and the last being the newest and most recent.
show tracklist 5
sound and music
none
none
Opens the ’tracker’, a music editor. turtleSpaces supports creation and playback of 6-channel waveform-generated music. See the help file available inside the tracker
tracker
booleans
none
boolean
Returns true if the calling turtle’s track is being generated / recorded. See track, notrack.
show trackp
shapes and graphics
none
none
Causes the calling turtle’s ’track’ to be rendered (updated) by the graphics renderer from the point it is called onwards. See notrackrender
trackrender
words and lists
number | word or list
word or list
Returns the specified number of trailing (ending) items in the provided word or list. See leading
print trailing 4 "teleport
port
show trailing 2 [dog cat pig frog]
[pig frog]
booleans
none
boolean
Returns true if the calling turtle’s track is being rendered.
show trackrenderp
environment
none
none
Writes out a session file to disk containing text input, output and traces, in the current project folder. See notranscript
transcript
booleans
none
boolean
Returns true if transcript is enabled. See transcript, notranscript
shapes and graphics
width (number) | height (number)
none
Creates a wireframe (pen-drawn) right-angle triangle to the front and right of the turtle.
triangle 10 20
booleans
none
true
Returns true. See false
show true
mathematics
number | decimalplaces (number)
number
Returns the input rounded to the specified number of decimal places.
print truncate 10.4325 2
10.43
conditionals and flow
list | list
none
Attempts to execute the instructions given in the first list, and if an error is encountered then executes the instructions in the second list. A one-off form of onerror. See onerror, throw, catch
try [repeat 10 [show 10 / (10 - repcount)]] [print |Divide by zero, silly!|]
shapes and graphics
radius (number) | depth (number) | sides (number)
none
Creates a hollow tube.
tube 10 20 20
shapes and graphics
thickness (number) | radius (number) | sides (number) | totalsegments (number) | arcsegments (number)
none
Creates a tube arc.
tubearc 5 15 20 20 10
shapes and graphics
thickness (number) | radius (number) | sides (number) | totalsegments (number) | arcsegments (number) | ratio (number)
none
Creates a tube arcoid (extruded based on the provided ratio).
tubearcoid 5 15 20 20 10 2
shapes and graphics
thickness (number) | radius (number) | sides (number) | totalsegments (number) | arcsegments (number) | startsides (number) | endsides (number)
Creates a slice of a partial tube. Note: If you invert the thickness value, you can ‘slice’ the opposite side.
tubearcslice 5 15 20 20 10 5 15
shapes and graphics
radius (number) | depth (number) | sidestotal (number) | sidesused (number)
none
Creates a ‘slice’ of a tube, based on the sidestotal and sidesused values.
tubeslice 20 20 10 4
shapes and graphics
radius (number) | depth (number) | sides (number) | ratio (number)
none
Creates a tuboid, or stretched tube.
tuboid 10 20 20 0.5
shapes and graphics
thickness (number) | radius (number) | sides (number) | totalsegments (number) | arcsegments (number) | ratio (number)
none
Creates a tube arc extruded by the provided ratio.
tuboidarc 5 15 20 20 10 2
shapes and graphics
thickness (number) | radius (number) | totalsides (number) | totalsegments (number) | arcsegments (number) | startsides (number) | endsides | ratio (number)
none
Creates a tube arc sliced by the provided sides values and extruded by the provided ratio.
tuboidarcslice 5 15 20 20 10 10 15 2
shapes and graphics
radius (number) | depth (number) | sidestotal (number) | sidesused (number) | ratio (number)
none
Creates a stretched ‘slice’ of a tube, based on the sidestotal and sidesused values, and the stretching ratio (normal is 1, half is 0.5, double is 2 etc.)
tuboidslice 10 20 20 10 0.5
tuboidslice 10 20 20 10 2
turtles
none
turtlename (word)
Returns the current turtle. See setturtle
show turtle
myrtle
none
turtlenames (list)
Lists the currently defined turtles.
show turtles
[myrtle libby snappy]
shapes and graphics
none
none
Lights both sides of the surface of a shape. Useful for shapes where both sides of the surface are visible. The default is that they are unlit. Whether to use twosided or not is a purely stylistic choice in most cases. See notwosided, which turns twosided off.
twosided
text
word, number or [list]
none
Outputs the specified data to the screen without following it by a carriage return. See print, show
type "frog type "pig
frogpig
shapes and graphics
word or [list]
Typeset renders the provided word or list as three-dimensional text to the right of the turtle one character at a time, moving the turtle to the right as it does so.
typeset [Welcome to turtlespaces!]
typeset {[Happy New Year] year [!]}
shapes and graphics
none
depth (number)
Returns the current depth of text rendered using typeset. See typeset
show typedepth
shapes and graphics
none
font (number)
Returns the index of the font used by typeset. See typeset
show typefont
shapes and graphics
none
size (number)
Returns the size of the text rendered by typeset. See typeset.
show typesize
shapes and graphics
none
size (number)
Returns the ratio by which text rendered by typeset will be stretched. See typeset.
show typestretch
environment
name or list
none
Unburies the named procedures. See bury.
unbury "myproc
environment
none
none
Unburies all procedures and containers currently buried in the workspace. See bury
unburyall
containers
word or list
none
Unburies the container(s) named in its input. See bury
unburyname "container
input and output
none
none
turtleSpaces autosaves any additions or changes to its current library of procedures. To revert to the previous autosave, use undo. To then revert to the next autosave (the one you were previously at) use redo. Note: if you add or change any procedures while in the autosave ‘chain’, the new autosave will be at the end of the chain, and you will need to undo back from the end to return to the state you were at prior to making the change. See redo
undo
words and lists
list
none
Returns only the unique elements of a list.
show unique [pig frog frog duck]
[pig frog duck]
shapes and graphics
co-ordinates [list]
none
‘Unplots’ or removes the pixel / voxel from the selected plot at the provided co-ordinates. The list of coordinates may contain two or three numbers, depending on if the selected plot is two- or three-dimensional. See plot
unplot [10 10]
unplot [20 10 10]
containers
name (word) or names (list)
none
Unlike eraseshare which erases the share and its container, unshare changes the share back into a ‘global’ (turtle-internal) container.
unshare "container
environment
word or list
none
Unmarks the named procedure or procedures from stepping. See step
unstep "procedure
conditionals and flow
comparison [list of requests]
none
Repeats the list of requests until the comparison is true.
make "count 1 until :count = 20 [inc "count]
environment
list
none
Stops tracing the specified procedures.
untrace [myproc]
movement and vectors
degrees
none
Angles the ’nose’ of the turtle up the specified number of degrees. If looking down at the turtle from above (the default view), up 90 will cause the turtle to point straight up towards you.
up 90
movement and vectors
none
vector (list)
Returns the calling turtle’s current up vector. See rightdir, forwarddir
show updir
movement and vectors
position (list)
[x-percent y-percent (list)
Returns the 2D position of the object as a percentage of the window / screen. For example, if the turtle appears to be in the dead center of the screen, unproject will return 50% across and 50% down. Note: If the co-ordinate is not in the view of the camera, unproject will return spurious results!
unproject myrtle:position
words and lists
word
word
Converts word to UPPERCASE.
print uppercase "i\ like\ to\ shout!
I LIKE TO SHOUT!
environment
none
word
Returns the name of the current user.
print user
boolean
name (word)
boolean
Returns true if the provided name is a currently defined user.
show userp "Bonnie
true
environment
none
list
Returns a list of the defined users.
print users
mathematics
vector (list) | vector (list)
list
Add two vectors giving a new vector.
vectoradd [0 1 0] [1 0 1]
[1 1 1]
mathematics
vector (list) | vector (list)
list
Returns vector perpendicular to the two provided vectors.
show vectorcross [0 .2 0] [0 0.5 0.5]
[0.1 0 0]
mathematics
vector (list) | vector (list)
number
Returns the “dot” product of two vectors.
show vectordot [0 0.12 0.12] [0.5 0 0.5]
0.06
mathematics
vector (list)
list
Returns a “normal” vector of length 1.
show vectornormal [20 20 20]
[0.5773502691896257 0.5773502691896257 0.5773502691896257]
mathematics
vector (list) | amount (number)
list
Multiply vector by given amount.
show vectormultiply [0.5 0.5 0.5] 2
[1 1 1]
movement and vectors
none
[forwarddir updir rightdir]
Returns the orientation vectors of the turtle as a list. This is the most reliable method of storing and restoring the orientation of a turtle, as opposed to the orientation function, which returns relative heading / pitch / roll values.
print vectors
mathematics
vector1 (list) | vector2 (list)
list
Subtract vector1 from vector2, giving a new vector.
show vectorsub [0 1 0] [1 0 1]
[1 -1 1]
environment
word or list
none
Opens the editor with the output provided to view.
view table "table
view workers
shapes and graphics
none
turtle-units (number)
Returns the value of the far clipping plane. See setviewfar
show viewfar
shapes and graphics
none
angle (number)
Returns the current viewing angle, or field of view. See setviewfov
show viewfov
environment
none
none
Opens the help file in the viewer. You can use the cursor keys to scroll through it. shift + up and down scroll through it faster!
viewhelp
shapes and graphics
none
turtle-units (number)
Returns the current near clipping plane. See setviewnear
show viewnear
environment
none
none
Opens the primitive reference file in the viewer. You can use the cursor keys to scroll through it, or control-shift-W to search for a particular primitive. shift + up and down scroll through it faster! You can open the reference faster using control-shift-R. See help
viewref
none
word
Returns the current view turtle
show viewturtle
"snappy
boolean
name (word)
boolean
Returns true if the named turtle is currently the view turtle.
show viewturtlep "snappy
true
booleans
none
boolean
Returns true if the calling turtle is in view of the current view turtle
show visiblep
sound and music
none
number
Returns the current ‘master’ volume.
show volume
booleans
character
boolean
Returns true if the provided character is a vowel (a e i o u or y)
show vowelp "u
shapes and graphics
turtle-steps
none
Creates a filled cube turtle-steps wide, high and deep to the right, forward and down of the turtle.
voxel 20
shapes and graphics
turtle-steps-right turtle-steps-forward turtle-steps-deep
none
Creates a filled cuboid to the right, forward and down of the turtle.
voxeloid 10 20 30
control
60ths-of-a-second (number)
none
Pauses execution for the amount of time specified in 60ths of a second. wait 60 pauses for one second.
wait 60
shapes and graphics
turtle-steps-right turtle-steps-forward
Creates a filled right-angle triangle turtle-steps-right from the turtle and turtle-steps-forward from the turtle in dimensions.
wedge 20 4
conditionals and flow
comparison [requests]
none
Waits until the comparison is true, then executes the provided requests. This blocks execution; it is not a trigger. To use it as such, use newworker eg newworker [when minutes = 0 [toot 1000 60]]
when minutes = 0 [toot 1000 60]
environment
none
list
Returns a list indicating the calling turtle’s currently inhabited sector, based on the selected zone. See selectzone, putsector
show whichsector
environment
none
list
Returns a list of the zones the turtle is currently inside of. See zones, newzone
show whichzones
conditionals and flow
comparison [instructions]
none
While the provided comparison is true, the supplied instructions will be repeatedly executed.
while 😡 < 10 [make "x :x + 1 print :x]
text
none
number
Returns the width of the text screen.
show width
turtles
none
none
Sets ‘window’ mode, in which the turtle is unrestricted and can leave the area defined by bounds. See fence, wrap
window
booleans
none
boolean
Returns true if the turtle is currently in ‘window’ mode. See window
show windowp
boolean
number or list | number or list | number of list
boolean
Compares two lists or numbers, returns true if they are within the variance specified by the third list of container. All three lists need to have the same number of parameters. Used mainly for comparing position / proximity of turtles.
show withinp [10 10 10] [15 15 15] [10 10 10]
true
show withinp 5 8 2
false
words and lists
word | word or list
word or list
Removes all instances of the specified word in the specified word or list and returns the result.
show without "pig [dog cow pig]
[dog cow]
show without "pig "dogcowpig
"dogcow
turtles
none
none
Sets the turtle in wrap mode, which means if the turtle reaches the edge of the area defined by setbounds, it wraps to the opposite side of that area. See window, fence.
wrap
booleans
none
boolean
Returns true if the turtle is currently in ‘wrap’ mode. See wrap, window, fence
show wrapp
words and lists
word or list | word or list
word
Combines its inputs into a single word, without spaces between them. word takes two inputs, unless enclosed in round brackets (). To combine multiple inputs into a word with spaces, see longword. To combine multiple inputs into a list, see sentence
show word "frog "duck
frogduck
show (word "one "two "three)
onetwothree
show (word [pig duck chicken])
pigduckchicken
booleans
none
boolean
Returns true if the input is a word.
show wordp "word
input and output
none
bytes (number)
Returns the current write position in bytes.
show writepos
input and output
none
filename (word)
Returns the name of the file currently open for writing.
show writer
control
id-number
boolean
Returns true if worker with id-number is running.
print workerp 123
control
none
list
Returns a list of running workers.
show workers
movement and vectors
none
xpos (number)
Returns the current x co-ordinate of the turtle.
show xpos
movement and vectors
none
ypos (number)
Returns the current y co-ordinate of the turtle.
show ypos
none
Returns the current year.
print year
2020
movement and vectors
none
zpos (number)
Returns the current z co-ordinate of the turtle.
show zpos
movement and vectors
none
none
Zeroes the turtle’s heading value. This does not modify the turtle’s orientation. Further changes will modify heading as appropriate. This primitive allows you to establish a new base heading value to work forward from. See heading
zeroheading
movement and vectors
none
none
Zeroes the turtle’s orientation values (pitch, heading, roll). This does not modify the turtle’s actual orientation. Further changes will modify orientation values as appropriate. This primitive allows you to establish new base orientation values to work forward from. See orientation
zeroorientation
movement and vectors
none
none
Zeroes the turtle’s pitch value. This does not modify the turtle’s orientation. Further changes will modify pitch as appropriate. This primitive allows you to establish a new base pitch value to work forward from. See pitch
zeropitch
movement and vectors
none
none
Zeroes the turtle’s roll value. This does not modify the turtle’s orientation. Further changes will modify roll as appropriate. This primitive allows you to establish a new base roll value to work forward from. See roll
zeroroll
environment
none
list
Returns a list of all zones defined in the current space.
show zones
movement and vectors
none
number
Returns the turtle’s ‘zoom’ value, which is relevant to its display when it is a view turtle. 100 (as in 100%) is the default value. See setzoom
show zoom