Content deleted Content added
m fixed mistaken disambiguation of Pascal |
Correction to History, functional version of Example 9, removed past tense |
||
Line 1:
[[fr:Logo]][[pl:J%EAzyk programowania Logo]] [[zh:Logo程序设计语言]]
Logo was
'''Logo''' is a computer [[programming language]] designed by [[Seymour Papert]] in the late [[1960s]] to teach computer skills to children. Papert is a professor at [[MIT]], and the author of ''Mindstorms: Children, Computers, and Powerful Ideas''. Logo is from the Greek word "logos" meaning "word".▼
Papert
later added the "turtle graphics" for which Logo is now most famous.
▲'''Logo''' is a computer [[programming language]]
Papert used [[Lisp programming language|LISP]] but changed the [[syntax]] so it is much easier to read. One could say that Logo is Lisp without the parentheses. Today, it is known principally for its "Turtle Graphics" but it has significant list handling facilities, file handling and I/O facilities and can be used to teach most computer science concepts, as Brian Harvey does in his "Computer Science Logo Style" trilogy. Equally it can be used to prepare [[microworlds]] for students to investigate.▼
Papert who is a professor at [[MIT]], and the author of ''Mindstorms: Children, Computers, and Powerful Ideas'',later added the turtle graphics for which Logo is now most famous.
▲Papert used [[Lisp programming language|LISP]] but changed the [[syntax]] so it is much easier to read. One could say that Logo is Lisp without the parentheses. Today, it is known principally for its "Turtle Graphics" but it has significant list handling facilities, file handling and I/O facilities and can be used to teach most computer science concepts, as Brian Harvey does in his "Computer Science Logo Style" trilogy. Equally it can be used to prepare [[microworlds]] for students to investigate
There are over 130 implementations of Logo- each having their own strengths. A popular Linux implementation is UCBLogo and MSWLogo its freeware Windows derivative is commonly used in UK schools, Comenius Logo is available in Dutch, German, Czech et c. and is worth considering.
==Logo Programming==
The idea is that a turtle with a pen strapped to it
The turtle
The idea of turtle graphics is also useful for
Line 65 ⟶ 70:
====Example 5: New words====
You can teach the turtle new words, i.e. groups of instructions,or procedures. These can to be done from
Line 76 ⟶ 81:
</code>
If you are using the editor you must exit from it, and the new word is saved into the
Now any time <code>CHAIR</code> is entered, "<code>REPEAT 4 [FD 100 LEFT 90] FD 30</code>" will be executed. You could compound these by <code>REPEAT 4 [CHAIR] if you wanted.</code>
====Example 6: Erasing (In the UCBLogo dialect)====
The turtle can erase a line. <code>PENERASE PE</code>. You must then replace the 'pen' with the command <code>PENPAINT PPT</code>.
Line 91 ⟶ 96:
END
</code>
====Example 7: Parameters- giving the word changeable information ====
Line 108 ⟶ 114:
==The Language==
Logo is an interpreted language. It is not case dependant , but retains the case used for formatting. It is written in lines . It is a compromise between a sequential programming language with block structures, and a functional programming language. There is no 'standard' LOGO, but UCBLogo is highly regarded. It is a teaching language but its list handling facilities make it remarkable useful for producing useful scripts.
===Functions/Procedures===
Line 142 ⟶ 148:
===Data===
There are three datatypes in UCBLogo,
* the word,
Line 186 ⟶ 192:
* Recursion rather than iteration is the natural method to process lists.
====Example 9: Using List
a: One way would be to use iteration.
to
ifelse lessp count :alist 5 [ op :alist ][
make "olist []
repeat 5 [ make "olist lput first :alist :olist make "alist bf :alist ]
end
show
[1 2 3 4 5]
foreach
[9 8 7 6 5]
b: Another, more elegant way would be
to firstn :num :list
if :num = 0 [output []]
output fput (first :list) (firstn :num-1 butfirst :list)
end
to firstfive :list
output firstn 5 :list
end
This method uses recursion, and is an example of a 'functional' rather than a 'sequential' programming approach.
===Control Structure Commands===
|