Amy full frontal


MSW Logo


teachers

kids

family
Home Top
E-mail Bottom

<Downloads>< Tutorials><History>
<The Language>
<DataTypes><Lists><I/O Commands>
< Logo or Pascal>< Template Commands ><Richness>< Examples>


MSW-LOGO An introduction for a Pascal trained programmer.

Introduction

When I picked up Integrate, the ACITT journal and found a copy of MSWLogo attached to the front, my first reaction was to say, "at last someone is taking LOGO seriously- this time I really must master it." This paper is really my 'learning notes' and may help others to enter the world of LOGO more speedily. The first point I must make is 'The errors are mine'. Then I must explain that I come to LOGO as a Pascal/C trained programmier working in the inner city with Keystage 3, 4 &5 youngsters- youngsters that don't specialise on intrinsic motivation- I speak the language of social inclusion.

I have noticed a lot of people coming to the Logo-L forum asking similar questions- like How do I start to learn Logo so that I can work with youngsters of-- such an age, and I know that there are many 'gifted and talented' professionals whose will help. All I intend to do is to provide a starting point

Goto Top


In the beginning..

In the early days of computing in UK schools, LOGO was there but we were too busy batching up cards or checking coding sheets for ‘O’s in line numbers- then there was CPM to learn. Then came the wave of hobby computers.

Ten years ago, a proportion of our pupils had learnt some rudimentary coding in Basic, and the problem was to minimise their bad habits and introduce rigour and structure into their programming generally by teaching Pascal. Now we must teach programming (control?) skills from scratch as computers don’t arrive with a built in programming language. So has LOGOs time come? Can it replace Pascal at ‘A’ level? Has it other uses?

LOGO’s worst enemies have been its own turtle graphics, the ‘born again’ fervour of its child centred advocates and its inaccessibily to ‘Pascal’ and Fortran trained programmers.

A good spin doctor would describe LOGO as a dialect of Lisp (the artificial intelligence language) with a user friendly graphical front end. He would then explain that it has all the constructs needed to teach programming principles with the minimum of ‘syntax traps’. He would eulogise on the way that datastructures can be taught, and the easy way that mathmos can tackle geometry and calculus. As MSWLogo is freeware- students can legally take a copy for their home machine.

Amy with attitude

Goto Top


What exactly is LOGO, UCBLogo and MSWLOGO

Scheme and Logo are two dialects of Lisp, a language based on the processing of lists by using a composition of functions. In Logo everything is a procedure call. Procedural languages like Basic, C, and Pascal ultimately derive from Fortran, but Logo is a Lisp with Turtle graphics. Its creator Papert, studied with Piaget, and then worked at MIT.

There is no published standard . Logo has many dialects, some long dead and some extended . MSWLogo, the version ACITTdistributed was written by George Mills based on the work of Brian Harvey. Both Logos are free, so can be passed on to colleagues and students.

Brian Harvey wrote UCBLogo as a standard Logo that can be used on UNIX, Linux, DOS and Windows in DOS Mode.. He is the acknowledged expert on Logo and has written the only serious textbook suitable for teachers of IT. Computer Science Logo Style. Three Volumes published by The MIT Press. I got a copy of Volume 1 for &pound;24.40 from amazon.co.uk. There are details of all his books on Logo and Scheme on his website.

http://www.cs.berkeley.edu/~bh/

George Mills adapted UCB to take advantage of Windows dlls. It is not as pure as UCB but allows you to control the windows interface and some hardware features. There is provision for accessing dlls, midi sound and networking through TCP/IP can be invoked.

http://www.softronix.com

Jim Muller has worked with LOGO since 1979 and has written an elegant textbook that provides KS2 and KS3 teachers with a wealth of ideas.

http://www.coserv.net/~tgla


Tutorials

There are many Logo Tutorials on the Web. I started with Paul Dench

http://www.ecu.edu.au/pa/ecawa/sig/logo/paul_dench/turtle/index.htm

Jim Fuller is writing LOGO- working on control through the games port He has written a excellent formal tutorial.

http://www.southwest.com.au/~jfuller/logotut/menu.htm

Logo can be used at all levels, this tutorial will move too fast for some.but addresses some of the problems of elementary robotics.

A new tutorial -or more a formal course is at the moment being written by Simone Rudge- it emphasises good practice and comes with assessment sheets and useful links.

http://www.yukoncollege.yk.ca/~srudge/comp052/notes.html  Yukon College Course

There is a wealth of logo ideas on the web, links can be found at

http://vlado.fmf.uni-lj.si/educa/logo/goto.htm.

The logo newsgroup allows you to talk to all the people mentioned. To join send email to (LogoForum-subscribe@egroups.com) with no other text.

I have some further links of my own including a useful Quick Reference Card.


Other Logos

Comenius Logo-also called SuperLogo- Written at the Comenius University, Bratislava. Some Excellent work for KS2/KS3 students. This will give you a starting point.

http://www.ksp.sk/ipsc/

http://www.edi.fmph.uniba.sk/tomcsanyiova/indexA.html

I have no experience

Microworlds-
Terrapin Logo
WinLogo ObjectLogo
Logowriter
Lego Logo
.Goto Top

The Language

Logo is an interpreted language. It is not case dependant. It is written in lines .
Functions/Procedures

Each line is made up of 'function calls'. There are two types

A command is similar to a Pascal procedure, and a operation is similar to a Pascal function.

A special subset of operations called predicates, that just output the word "true or "false, these are conventionally written with a final ‘p’- like emptyp, wordp, listp.

Expressions can be primitives, or can be defined by the user.

Expressions can take zero, one or more parameters.

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

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

Goto Top

Data

There are three datatypes,

A number is a special case of word.

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

There are two important symbols

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

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

Assignment in Pascal x:= y +3 becomes in Logo
make "x sum :y 3 or
make "x sum :y "3
make takes 2 parameters, the second of which here is sum :y "3. Now sum takes two parameters and is a operation, thus the calculation is possible. "3 evaluates to 3, and :y takes the contents of the thing called y, these are summed giving a number. The effect of make is to place the result into the first parameter.
 

An alternative way of looking at this, maybe, isthat the second parameter is ‘passed by value’ while the first is ‘passed by address.’ Discuss.

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

Scoping Variables don’t have to be declared before use. Their scope is then global.
A variable may be declared local, when its scope is limited to that procedure and its subprocedures. This is dynamic scoping. Calling a procedure with inputs, creates local variables which hold the contents of the parameters.
Goto Top

Lists

Discussing lists comes as a surprise to the Pascal programmer, who has managed quite well without them, however this opens many new possibilities. There seems to be few tutorials on this at any level- and none that can be plagiarised for school use. Arrays are also provided for the timid.

Goto Top


Control Structure Commands

The standard Pascal controls are available, there is selection

There are iteration commands

Recursion is Logo prefered processing paradigm.

Goto Top


I/O Commands

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

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

MSWLogo allows input from COM ports and LPT ports and also ‘hardware‘ ports. MSWLogo also supports a windows interface thus I/O is available through this GUI- and keyboard and mouse events can trigger interrupts.

Amy puts her foot down
Goto Top

Logo instead of Pascal?

Logo is slow, it is not suitable for processsing vast amount of data- but surely this isn’t the point at ‘A’ level. Speed is not an issue anymore – sometimes it is educationally more useful if you can watch your program cranking through a problem. The visual output allows this. It assists the students understanding that the computer is working sequentially through the instructions.

Logo scores on graphics, and MSW allows you to use the Windows dll.. The crucial point for ‘A’ level teaching in Pascal is that students must master ‘pointers’ before they can do any useful data structure theory. This excludes all except the most committed. In Logo, Lists, stacks and queues are trivial. Trees are more fun. All are recursive in nature. .

Our students can be ‘reluctant progammers’ Many take no pride in computer programming and here the superior graphics helps to retain interest- Pascal cannot offer that.

If you are that committed to Pascal, UCBLogo and MSWLogo include a rudimentary Pascal intrepreter written in Logo as one of its examples

Goto Top

Unfamiliar Control structures

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

OPERATION [ a list of commands ] [ many data items ]
each of the commands is applied in turn to each of the data items. There are several of these ‘template ‘commands with names likeMAP, APPLY, FILTER, FOREACH, REDUCEand CASCADE. They repesent four flavours of template iteration, known as explicit-slot, named-procedure, named-slot (or Lambda) and procedure-text. This is a further step in programming that one can choose to ignore until time and curiosity become available. But look at these examples
show map [? * ? ] [ 5 6 7 ]
[25 36 49 ]
show filter [ (count ? ) > 4 ] [ the quick brown fox jumps over the lazy dog ]
[quick brown jumps]

The richness of MSW Logo

Yes, there is turtle graphics. While ten years ago youngsters were excited by drawing a simple line on the screen, their aspirations have changed. The turtle graphics can be used to demonstrate visually the more complex ideas such as iteration and recursion. Its weakness is that it sends out the message that- "I used that when I was eight—do you think I am a baby?"

This is not a problem if.

The expert can generate series of graphics in LOGO. Save them as bitmaps then combine them as an animated gif for the killer web page.

With MSWLogo students can draw on the screen modal and modeless windows, buttons, comboboxes and slidebars. The buttons can be programmed to invoke code. Such a GUI is essential in todays youngsters minds. It allows the less gifted the chance of producing sa professional looking front end. It allows students to trigger events- in a way not offered in Pascal. It frees vast amounts of practical time for deeper study- and leads in to Form design in Access.

A tune is essentially a list of notes, and MSW has a sound command. It also can use MIDI files. More potential for gaining students interest. As you invoke the frequency and time as parameters there is opportunity to investigate the physics of music.You can get multiple PCs singing in harmony.

There is I/O to files, keyboard, to the COM and LPT ports, and from the games port. There are TCP/IP networking functions. This allows control possiblities. All I personally need is a set of ready made robots, and an operating system that allows me personal control of my machines I/O ports.

MSW Logo is rich, it is freeware and MSWLogo can deliver. What’s missing seems to be simple tutorials explaining these things. We need tutorials to extend the gifted, we need tutorials for the average and tutorials for special needs. We need tutorials on all aspects of the National curriculum. We need tutorials written in a way that we as Fortran/Pascal trained teachers can understand.

Amy

Goto Top


<Downloads>< Tutorials><History>
<The Language>
<DataTypes><Lists><I/O Commands>
< Logo or Pascal>< Template Commands ><Richness>< Examples>



MSW Logo


teachers

kids

family
Home Top
E-mail Bottom

Google

Examples


A small demonstration program
to aaa
;;
;; An example-Hello World. This shows the time function, and how to remove
;; the first word. We also see how buttons and windows can be made. By pressing
;; the ‘*’ button, we get a demo of co-ordinates and the random function.
;;
end
 
to all.over
windowdelete "earth ;tidy up
end
 
to boldly.go ;Sets a location
pu setxy -250 + random 500 -150 + random 300 pd
rt random 360 ;sets the pointers angle
end
 
to galaxy :num ;Draws ‘n’ stars
repeat :num [ boldly.go star random 50 ] ;of random size
end
 
to star :size
repeat 5 [fd :size rt 144 ]
end
 
to zzz
local "wnx make "wnx 100 local "wny make "wny 90
local "marx make "marx 5 local "mary make "mary 20
local "sizx make "sizx 10 local "sizy make "sizy 10 ;setting local variables
windowcreate "main "earth [Greeting the World] 0 0 :wnx :wny []
buttoncreate "earth "bm "* :marx+:sizx*4 :mary+:sizy*1 :sizx :sizy [galaxy 50]
buttoncreate "earth "bz "x :marx+:sizx*8 :mary+:sizy*5 :sizx :sizy [all.over]
staticcreate "earth "bw [Hello World] 25 50 50 25 ;using windows is easy
staticcreate "earth "bt bf time 25 5 50 25 ;time is a list of words
end
Make "startup [zzz]
Goto Top Hello World
Galaxy
Goto Top

Adding intelligence to the race track game
to aaa.comment
;;
;; Here is the race track game - but the turtle is programmed to find its own
;; way round the track. It does so by using the pixel command to test whether
;; it is still on the red track (4 ) or has fallen off. This is not as easy as
;; it sounds!! In fact there are far better ways of doing this than this. The
;; challenge is to get it to work properly!
;;
end
to make.course
setpc 4 setpensize [ 20 20 ]
rt 60 fd 60 rt 40 fd 120
rt 100 fd 150 rt 90 fd 120
rt 65 fd 80
end
to track
make "hue pixel
make "trail 0 setpc :trail
setpensize [ 2 2 ]
repeat 1000 [ walk.step ifelse :hue = pixel [ walk] [ walk.back ] ]
end
 
to walk
bk 1 fd 2
end
 
to walk.back
bk 5 rt 30 fd 5
end
 
to walk.step
pu fd 1 pd show pixel
end Race Track
foreach iseq ascii "A ascii "Z [show char ?] ;A template function
Goto Top
 

Clem Rutter was an Elected Member of Medway Council and taught  IT at Crown Woods School ( London's Largest Comprehensive School) in Greenwich, UK.
Amy who consented to pose for all the photos was a  Medway resident, but has retired to Devon.

In the UK, children enter Year R at 4 years, Year 1 at 5 years and continue to Year 11 at 16years.
Years 1 and 2 are in Key Stage 1 (5-7), years 3 to 6 are in Key Stage 2 (7-11)
Years 7 to 9 are in Key Stage 3 (11-14) and years 10 and 11 are in Key Stage 4 (14-16).

They optionally do Year 12 and 13 also called the Sixth Form and KeyStage 5.


<Downloads>< Tutorials><History>
<The Language>
<DataTypes><Lists><I/O Commands>
< Logo or Pascal>< Template Commands ><Richness>< Examples>