Sie sind auf Seite 1von 4

MSW Logo List Processing Primitive Command Summary

Commands Shortcut Action


clears the text screen
cleartext ct
prints the item (word, list or result) to the text screen
print i pr i
shows the item with " or [] as appropriate
show i -
holds the item in buffer until print is encountered then prints all
type i -
returns the value of i to the calling procedure
output i op

Constructors
joins two items (words or lists) together with a space between (as a
sentence i i se i i list)
joins two items (words or letters) together with no space (as a word)
word i i -

De-Constructors
returns the first item of input (a word or list)
first i -
returns everything but the first item of input (a word or list)
butfirst i bf i
returns the last item of input (a word or list)
last i -
returns everything but the last item of input (a word or list)
butlast i bl i
returns the nth item of i
item n i -

Conditional Tests
when test returns "true" does commands and continues, otherwise
if (test) [commands] continues
when test returns "true" does first commands and continues, when
ifelse (test) [commands]
test returns "false" does second commands and continues
[commands]
sets flag to "true" or "false"
test (test)
checks flag before completing commands
iftrue [commands]
checks flag before completing commands
iffalse [commands]

Predicates (some more commonly used ones)


returns true if inputs are equal, otherwise returns false
equalp i i -
returns true if the first i is a member of the second group i, otherwise
memberp i i - returns false
returns true if the input (word or list) is empty, otherwise returns false
emptyp i -
returns true if the input is number, otherwise returns false
numberp i -
returns true if the input is a word (not a list), otherwise returns false
wordp i -
returns true if the input is a list (not a word), otherwise returns false
listp i -

Turtle Graphics

Commands Shortcut Action


moves the turtle forward n turtle steps
forward n fd n
moves the turtle backwards n turtle steps
backward n bk n
turns the turtle right n degrees
right n rt n
turns the turtle left n degrees
left n lt n
eg. repeat 4 [fd 50 rt 90] will draw a square
repeat _
makes the turtle invisible (it will move much faster when invisible)
hideturtle ht
makes the turtle visible
showturtle st
clears the graphics screen and returns the turtle to home position
clearscreen cs
clears the screen but leaves the turtle where it is
clean _
sends the turtle to home position but leaves the drawing as is
home _
removes the list of commands from the commander window
cleartext ct
lifts the turtle's pen so it doesn't draw when moving
penup pu
puts the turtle's pen back down so it will draw when moving
pendown pd
changes the pen to an eraser
penerase pe
causes the pen to erase over existing lines, otherwise draw
penreverse px
returns the drawing version of the pen after erasing or reversing
penpaint _
keeps the turtle from wrapping or going off the edge of the window
fence _
keeps the turtle from wrapping and allows it to go out of the window
window _
makes the turtle wrap around the screen when it gets to one edge
wrap _
uses two values for pen size, height and width
setpensize [n n] _

setscreencolor [n n setsc [n n sets screen background colour**


n] n]

setpc [n n sets pen colour**


setpencolor [n n n]
n]
sets the colour** to fill with if the fill command is used floods the area
setfloodcolor [n n setfc [n n
where the turtle is with the flood colour
n] n]

Fill _
moves the turtle to the x, y coordinates given
setpos [n n] _
moves the turtle to x or y coordinates given
setx n or sety n _
outputs the x and y or x or y position of the turtle
pos or xcor or ycor _
sets the turtle's heading in degrees (0 is up)
Setheading n seth n
outputs the heading the turtle would have if facing x, y given
towards [n n] _
eg. to square defines the name of a procedure to teach logo
to procedure _ commands
takes you to the editor to edit a procedure
edit procedure _
eg. to square :size sets a variable :size that can be used in square
:variable_name _
repcount none the number of times that a procedure has been repeated
PERSPECTIVE none Switch to 3D mode
LEFTROLL n none Rolls the turtle (on to his left side) by n degrees
RIGHTROLL n none Rolls the turtle (on to his right side) by n degrees
UPPITCH n none Pitches the turtle nose up by n degrees
DOWNPITCH n none Pitches the turtle nose up by n degrees

Das könnte Ihnen auch gefallen