|
MSW Logo List Processing Primitive Command Summary |
||
|
Commands |
Shortcut |
Action |
|
cleartext |
ct |
clears the text screen |
|
print i |
pr i |
prints the item (word, list or result) to the text screen |
|
show i |
- |
shows the item with " or [] as appropriate |
|
type i |
- |
holds the item in buffer until print is encountered then prints all |
|
output i |
op |
returns the value of i to the calling procedure |
|
Constructors |
||
|
sentence i i |
se i i |
joins two items (words or lists) together with a space between (as a list) |
|
word i i |
- |
joins two items (words or letters) together with no space (as a word) |
|
De-Constructors |
||
|
first i |
- |
returns the first item of input (a word or list) |
|
butfirst i |
bf i |
returns everything but the first item of input (a word or list) |
|
last i |
- |
returns the last item of input (a word or list) |
|
butlast i |
bl i |
returns everything but the last item of input (a word or list) |
|
item n i |
- |
returns the nth item of i |
|
Conditional Tests |
||
|
if (test) [commands] |
when test returns "true" does commands and continues, otherwise continues | |
|
ifelse (test) [commands][commands] |
when test returns "true" does first commands and continues, when test returns "false" does second commands and continues | |
|
test (test) |
sets flag to "true" or "false" | |
|
iftrue [commands] |
checks flag before completing commands | |
|
iffalse [commands] |
checks flag before completing commands | |
|
Predicates (some more commonly used ones) |
||
|
equalp i i |
- |
returns true if inputs are equal, otherwise returns false |
|
memberp i i |
- |
returns true if the first i is a member of the second group i, otherwise returns false |
|
emptyp i |
- |
returns true if the input (word or list) is empty, otherwise returns false |
|
numberp i |
- |
returns true if the input is number, otherwise returns false |
|
wordp i |
- |
returns true if the input is a word (not a list), otherwise returns false |
|
listp i |
- |
returns true if the input is a list (not a word), otherwise returns false |
|
Turtle Graphics |
||
|
Commands |
Shortcut |
Action |
|
forward n |
fd n |
moves the turtle forward n turtle steps |
|
backward n |
bk n |
moves the turtle backwards n turtle steps |
|
right n |
rt n |
turns the turtle right n degrees |
|
left n |
lt n |
turns the turtle left n degrees |
|
repeat |
_ |
eg. repeat 4 [fd 50 rt 90] will draw a square |
|
hideturtle |
ht |
makes the turtle invisible (it will move much faster when invisible) |
|
showturtle |
st |
makes the turtle visible |
|
clearscreen |
cs |
clears the graphics screen and returns the turtle to home position |
|
clean |
_ |
clears the screen but leaves the turtle where it is |
|
home |
_ |
sends the turtle to home position but leaves the drawing as is |
|
cleartext |
ct |
removes the list of commands from the commander window |
|
penup |
pu |
lifts the turtle's pen so it doesn't draw when moving |
|
pendown |
pd |
puts the turtle's pen back down so it will draw when moving |
|
penerase |
pe |
changes the pen to an eraser |
|
penreverse |
px |
causes the pen to erase over existing lines, otherwise draw |
|
penpaint |
_ |
returns the drawing version of the pen after erasing or reversing |
|
fence |
_ |
keeps the turtle from wrapping or going off the edge of the window |
|
window |
_ |
keeps the turtle from wrapping and allows it to go out of the window |
|
wrap |
_ |
makes the turtle wrap around the screen when it gets to one edge |
|
setpensize [n n] |
_ |
uses two values for pen size, height and width |
|
setscreencolor [n n n] |
setsc [n n n] |
sets screen background colour** |
|
setpencolor [n n n] |
setpc [n n n] |
sets pen colour** |
|
setfloodcolor [n n n] |
setfc [n n n] |
sets the colour** to fill with if the fill command is used floods the area where the turtle is with the flood colour |
|
Fill |
_ |
|
|
setpos [n n] |
_ |
moves the turtle to the x, y coordinates given |
|
setx n or sety n |
_ |
moves the turtle to x or y coordinates given |
|
pos or xcor or ycor |
_ |
outputs the x and y or x or y position of the turtle |
|
Setheading n |
seth n |
sets the turtle's heading in degrees (0 is up) |
|
towards [n n] |
_ |
outputs the heading the turtle would have if facing x, y given |
|
to procedure |
_ |
eg. to square defines the name of a procedure to teach logo commands |
|
edit procedure |
_ |
takes you to the editor to edit a procedure |
|
:variable_name |
_ |
eg. to square :size sets a variable :size that can be used in square |
| 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 |