Discussion:
Berkeley Logo (UCBLogo) 5.5 released (freeware)
(too old to reply)
Brian Harvey
2005-08-10 05:22:21 UTC
Permalink
Release 5.5 of Berkeley Logo is now available by anonymous FTP or Web.
Versions are available for Unix, Windows, and MacOS X. (The DOS and
MacOS Classic versions are frozen at 5.3, still online.)
Berkeley Logo (a/k/a UCBLogo) is FREE SOFTWARE, with source code included.
-------------

Logo is the educational programming language best known for its "turtle
graphics" but also featuring easy and powerful facilities for computing
with words and sentences. Sample projects included with the Berkeley
Logo distribution range from a tic-tac-toe game to a Pascal compiler and
a Logo implementation of Student, Daniel Bobrow's program that solves
algebra word problems.

Berkeley Logo is distributed under the terms of the GNU General Public
License: You may redistribute it freely, and you may use it as a base
for developing additional free software, but you may not use it as a base
for commercial software products. The exact details are included in the
distribution, in the file named GPL.

Advantages of Berkeley Logo:

* It's free.
* It comes with source files (in C).
* Logo programs are completely compatible among Unix, PC, and Mac.

Disadvantages of Berkeley Logo:

* It's relatively slow.
* It doesn't do anything fancy about graphics. (One turtle.)

This announcement has five more parts:
* How to get Berkeley Logo.
* Installation instructions.
* Details about this release.
* Pointers to other people's Berkeley-Logo-related distributions.
* Instructions for DOS and MacOS Classic.

----------------------------------------
HOW TO GET BERKELEY LOGO:
----------------------------------------

To use a web browser, go to
http://www.cs.berkeley.edu/~bh/logo.html

Or, FTP to ftp.cs.berkeley.edu and get any of the following files:

pub/ucblogo/ucblogo.tar.gz Unix sources and documentation (gzip format)

pub/ucblogo/ucbwlogosetup.exe Windows version, self-installing, with
executable UCBWLOGO.EXE

pub/ucblogo/macosx-ucblogo-Installer.hqx
Mac OS X version, BinHexed installer

pub/ucblogo/usermanual Just the documentation file.

(The filenames above are links to filenames that include the version number,
e.g., ucblogo-5.5.tar.gz; either name is okay. Anything other than these
versions, if still online, is in the subdirectory pub/ucblogo/old.)

-----------

The Windows and Mac versions include a SOURCE subdirectory containing
the C source files used to compile Berkeley Logo. If you don't want to play
with the code, you can delete this directory and all its contents. You can
also delete some or all of the contents of the DOCS directory, which has the
usermanual in various formats (Postscript, PDF, HTML, INFO, TEXI). The
HTML files are particularly huge, if you're looking for something to delete.
(In the Unix version, the source files are in the top-level directory of the
distribution.)

In the source directory, the file plm is a Program Logic Manual that
documents some of the inner mysteries of this interpreter. You should read
_Structure and Interpretation of Computer Programs_ before you read plm.
Also included is evaluator.ps, a beautiful one-page simplified flowchart
of the evaluator to admire while reading plm.

In the Unix version, if you want to save space, you can delete the entire
ucblogo directory created by tar once you've done "make install".

----------------------------------------
INSTALLATION INSTRUCTIONS:
----------------------------------------

The Unix version is a compressed tar file. To install it, copy to your
machine, then say
gunzip ucblogo.tar
tar -xf ucblogo.tar
cd ucblogo
configure
make

The makefile compiles with optimization turned off. This is necessary to
avoid mysterious garbage collection failures. (NOTE: On my HP 712, for
reasons I don't understand, I had to compile the entire interpreter without
optimization. But on other platforms, such as PCs running Linux and FreeBSD,
it's sufficient merely to un-optimize mem.c. If that works on your machine,
you can remove the "-O0" at the end of the CFLAGS line at the beginning of the
makefile, after running configure.)

A real UI project is in the works, but meanwhile, you might be interested in
rlwrap, a program that "wraps" the GNU Readline library around an arbitrary
command, so that by saying "rlwrap logo" you'll be able to get line editing,
command history, etc:
http://utopia.knoware.nl/~hlub/uck/rlwrap/

---------

The Windows version is in the form of an installer, with the usual options
for desktop icons and the like.

The Logo interpreter, named UCBWLOGO.EXE, requires Windows 95/98/Me/NT/2000/XP
or later (not 3.1; sorry). It is distributed as a self-installing setup file.

---------

There is a separate installer for the Mac OS X version. This is the same
as the Unix version, but precompiled for the Mac. You must also install
the X11 package from the Developer Tools CD-ROM in the OS X distribution.
(The Logo installer will warn you if you don't have X11 installed.) You
need an administrator account to install Logo.

If you're installing Logo at a school at which nobody uses X11 for anything
else, you can make it so clicking the X11 icon in the dock will start Logo
as it's starting X11. To do that, in the file /etc/X11/xinit/xinitrc,
change the lines at the end that now say
# start some nice programs
xterm &
# start the window manager
exec quartz-wm
so that they instead say
/usr/X11R6/bin/quartz-wm &
/usr/X11R6/bin/xterm +sb -n Logo -e logo
I actually put more xterm arguments on that last line, to control the
appearance of the window to suit my preferences, like this:
/usr/X11R6/bin/xterm +sb -n Logo -bg black -fg white -ms orange
-fn -adobe-courier-medium-r-normal--20--75-75-m-0-iso8859-1
-geometry 80x25-5+124 -e logo
(That's actually one long line in the file.) Say "man xterm" in the shell
to learn all the options.

A real UI project is in the works, but meanwhile, you might be interested in
rlwrap, a program that "wraps" the GNU Readline library around an arbitrary
command, so that by saying "rlwrap logo" you'll be able to get line editing,
command history, etc:
http://utopia.knoware.nl/~hlub/uck/rlwrap/

----------------------------------------
THIS RELEASE:
----------------------------------------

All platforms:

The turtle is drawn one step behind its actual "hot spot" position,
so that after drawing a polygon it doesn't obscure part of the
resulting figure. (This is a heuristic; it will still obscure parts
of really dense figures.)

PRINTOUT un-abbreviates PO.

A valid procedure name followed by a string of digits, with no space
in between, e.g., FD100, is recognized as if there were a space, with
a warning message.

BUTTONP outputs TRUE if a mouse button is down and the mouse is
over the graphics window. Once the button is down, BUTTONP remains
true until the button is released, even if the mouse is dragged out
of the graphics window.

BUTTON outputs 0 if BUTTONP would output FALSE; otherwise, it
outputs an integer between 1 and 3 indicating which button was
pressed. Ordinarily 1 means left, 2 means right, and 3 means
center, but operating systems may reconfigure these.

MOUSEPOS outputs the coordinates of the mouse, provided that it's
within the graphics window, in turtle coordinates.

SETPC/SETBG now accept either a color number as before or an RGB list;
PC/BG output whichever form was most recently given to SETPC/SETBG.

SETPENSIZE accepts a single positive integer n meaning [n n].

ARC reduces angles greater than 360 to 360 + (angle mod 360) so that
long uninterruptable arcs don't happen when kids type in huge angles.

CLEARTEXT flushes output so it happens right away.

Backquotes (`) can now be nested.

New demo programs (in CSLS folder even though not from CSLS):
MINES (minesweeper), MASTER (mastermind), DOTGAME (dots).
Also STREAMS (inelegant implementation of lazy lists) and
BUTTONS (simple GUI with clickable buttons in graphics window).
The file GAMEDOC in the UCBLOGO directory (Mac version: installed
into /usr/doc/logo/gamedoc) documents these new projects.

Turtle moves with distance greater than 2^31 get an error message
instead of wrong results.

Error message for extra procedure inputs inside parens now includes
the procedure name.

Fixed parsing in LOAD of lines with both ; and ~.

Fixed buffer overrun in copydef of procedure with long title line.

Buried variable LogoVersion has as its value a floating point
number equal to the current UCBLogo version number.

Buried variable LogoPlatform has as its value one of these words:
Unix-Nographics
Windows
X11

Better error message when the expression returned by a macro uses
an undefined procedure.

Most file I/O error messages include the filename.

Windows:

The MAXIMIZE.WINDOW command takes one input. If TRUE, maximize
the Logo window to fill the screen; if FALSE, return the window to
its ordinary size. (I added this just for Windows because I needed
it to let the new game examples fit! Soon there'll be a uniform
cross-platform UI, I promise.)

The installer lets you choose between Jove (the mini-Emacs that has
always been included with UCBLogo) and Notepad (M$ stripped-down
editor for beginners) as the default editor.

Mac:

Installer allows TextEdit or Emacs as the default editor.

Unix:

----------------------------------------
OTHER UCBLOGO-RELATED DISTRIBUTIONS:
----------------------------------------

MSWLogo is a free port of Berkeley Logo to Microsoft Windows done by George
Mills. He has added a lot of Windows-specific capability to the language,
so you can do cool multimedia stuff with it. Look in

http://www.softronix.com/logo.html

---

Adaptation francaise pour MSWLogo et UCBLogo:

A startup file and documentation for UCBLogo in French is at

http://www.algo.be/logo1/MSWlogo-fr.html

Thanks to Francis Leboutte.

----------------------------------------
VERSION 5.3 FOR OLDER PLATFORMS:
----------------------------------------

To use a web browser, go to
http://www.cs.berkeley.edu/~bh/logo.html

Or, FTP to ftp.cs.berkeley.edu and get any of the following files:

pub/ucblogo/blogo.exe DOS version, PKZIP format, including
executables BL.EXE and UCBLOGO.EXE

pub/ucblogo/ucblogo.sea Mac Classic version, StuffIt format,
w/executable Logo
pub/ucblogo/ucblogo.sea.hqx Mac Classic version, BinHexed StuffIt format,
including executable Logo

Be sure to use BINARY transfer mode when retrieving the archive files!

-----------

The DOS 5.3 version is in the form of a self-extracting PKZIP archive.
Run BLOGO.EXE ; it will create two files, INSTALL.BAT and INSTALLU.EXE. Then
run INSTALL to create a C:\UCBLOGO directory with the complete
distribution. If you want to install
Logo somewhere other than C:\UCBLOGO, you can say
installu -d d:\foo\
to put it in d:\foo\ucblogo. DON'T FORGET THE "-d" PART!

The DOS distribution includes two executable programs. BL.EXE runs on any
DOS PC, but is limited to 640K of memory. UCBLOGO.EXE requires a
286-or-better processor, but is able to take advantage of extended memory if
you have it. Read the README file for technical details.

The BL.EXE version, for really old 8086 PCs, is frozen at version 3.6,
because the garbage collection algorithm introduced in version 4.0
doesn't work well with really small memory.

-----------

The Mac Classic 5.3 version is in the form of a BinHex-converted
self-extracting StuffIt archive. To install it, just copy to your hard disk,
un-BinHex it (this may be done automatically by your file transfer program),
and double-click on it.
Hrvoje Blazevic
2005-08-10 12:15:49 UTC
Permalink
Post by Brian Harvey
Release 5.5 of Berkeley Logo is now available by anonymous FTP or Web.
Versions are available for Unix, Windows, and MacOS X. (The DOS and
MacOS Classic versions are frozen at 5.3, still online.)
Berkeley Logo (a/k/a UCBLogo) is FREE SOFTWARE, with source code included.
-------------
Installation on Fedora Core 4 crashes when MAKE descends into emacs
directory with the following message:

...
rm helptemp
(cd emacs; prefix=/usr/local LIBLOC=/usr/local/lib/logo
BINDIR=/usr/local/bin @MAKE@)
/bin/sh: @MAKE@: command not found
make: *** [logo-mode] Error 127



The only change you introduced (that a 5 second examination revealed)
was from MAKE = gmake to MAKE = @***@. ???

-- Hrvoje
Brian Harvey
2005-08-10 16:15:48 UTC
Permalink
Damn! I keep tripping over this problem -- some BSD systems require you to
say gmake, not make, in order for the script to work. *My* Linux has gmake
defined. Anyway, I patched configure to check for gmake and if not found to
use make -- I hope. Please re-download it and run configure again and see if
your makefile now works. Thanks.
Hrvoje Blazevic
2005-08-10 21:56:40 UTC
Permalink
Post by Brian Harvey
Damn! I keep tripping over this problem -- some BSD systems require you to
say gmake, not make, in order for the script to work. *My* Linux has gmake
defined. Anyway, I patched configure to check for gmake and if not found to
use make -- I hope. Please re-download it and run configure again and see if
your makefile now works. Thanks.
It does--thanks.

-- Hrvoje
Andreas Micheler
2005-08-14 16:58:34 UTC
Permalink
Brian,

Could you give me some *easy* examples of how to use your new streams?

(I'm trying to get your nice three new games working in aUCBLogo,
and of course this is not so easy because I don't really understand the
games' internal logic and aUCBLogo's colonless variables can't be named
like procs without getting wrong results. I have the dotgame already
running, but now I'm stuck with mastermind's computer algorithm.)

Greetings!
Andreas
Brian Harvey
2005-08-14 19:17:20 UTC
Permalink
Post by Andreas Micheler
Could you give me some *easy* examples of how to use your new streams?
...
Post by Andreas Micheler
but now I'm stuck with mastermind's computer algorithm.
Well, first of all, you could de-stream the program to study it (and even to
run it, although it'd be somewhat slower, especially before making its first
guess). For example, we have

make "perms stream.filter
`[okay? ? ,:guess.exact ,:guess.inexact ,:guess.word]
:perms

as a typical stream-using instruction in Mastermind. This is entirely
equivalent to

make "perms filter
[okay? ? :guess.exact :guess.inexact :guess.word]
:perms

if :PERMS were an ordinary list.


Did you read the GAMEDOC file in the Logo distribution? It includes both an
explanation of streams and a discussion of Mastermind's algorithm.


Here's a simple stream example. We'd like to write a PRIME? predicate that
takes an integer N greater than 1 and returns TRUE iff it has no factors
between 2 and N-1:

to prime? :n
output empty? filter [divisible? n ?] iseq 2 :n-1
end

The procedure above is an exact representation in Logo of the definition of
primeness given in English in the last paragraph -- it's a beautiful, simple,
elegant procedure. But it's terribly inefficient. Suppose we want to know
whether 1000000 is prime. This program will first generate a list of 999998
numbers: [2 3 4 5 6 ... 999997 999998 999999]. That's already pretty slow.
Then it filters that list, keeping only the factors of 1000000:
[2 4 5 8 10 16 20 ... 250000 500000]. Then, having generated this list by
dividing 1000000 by 999998 different numbers, it merely asks whether or not
the list is empty! Once we know that 2 is a factor of 1000000, there's really
no need to generate and test any other potential factors. To avoid this
inefficiency, prime-testing programs are traditionally written in a very
different style:

to prime? :n
output factor.tester :n 2
end

to factor.tester :fact :n
if :fact=n [output "true]
if divisible? :n :fact [output "false]
output factor.tester :fact+1 :n
end

This program has the virtue that it immediately discovers that 1000000 is
divisible by 2 and outputs FALSE without any further testing. But we've
given up elegance and expressiveness -- I claim it's harder to read this
program and work out its connection with the English definition of primality.

Streams let us have our cake and eat it too. We say

to prime? :n
output empty? stream.filter [divisible? :n ?] stream.iseq 2 :n-1
end

This version *looks like* the first version -- the only difference is that
FILTER has become STREAM.FILTER and ISEQ has become STREAM.ISEQ. But it
*runs like* the second version! It sees right away that 1000000 is divisible
by 2, and doesn't have to try any more numbers.

In the original version, ISEQ 2 :N-1 generates a list with 999998 elements.
But in this version, STREAM.ISEQ 2 :N-1 generates this list:

[2 *delayed* [stream.iseq 3 999999]]

That short, quickly-generated list is the input to STREAM.FILTER, which tests
its first element (2) and finds that 1000000 is indeed divisible by 2. So
STREAM.FILTER returns this list:

[2 *delayed* [stream.filter [divisible? :n ?]
[3 *delayed* [stream.iseq 4 999999]]]]

This is a complicated list, with a promise inside a promise, but it doesn't
matter, because the list becomes the input to EMPTY?, which outputs FALSE
without ever "cashing in" either promise.

Suppose we'd asked whether 999999 is prime. In that case, the input to
STREAM.FILTER would be

[2 *delayed* [stream.iseq 3 999998]]

Since 999999 is not divisible by 2, STREAM.FILTER would call itself recursively
with the TAIL of the stream as its input. The TAIL procedure cashes in (RUNs)
the promise, so it would call STREAM.ISEQ again, and get the result

[3 *delayed* [stream.iseq 4 999998]]

Since 999999 *is* divisible by 3, STREAM.FILTER then returns

[3 *delayed* [stream.filter [divisible? :n ?]
[4 *delayed* [stream.iseq 5 999998]]]]

This is the input to EMPTY?, which of course outputs FALSE.

If the number *is* prime, though, STREAM.FILTER keeps calling TAIL until it
reaches the empty stream (a/k/a the empty list) -- it has to try every
possibility. (Of course any of these procedures could be improved by testing
only potential factors up to SQRT :N.)

In the PRIME? example, it's okay to have :N as part of the delayed call to
STREAM.FILTER, because :N is an input to the top-level PRIME? procedure and
doesn't change in any recursive calls. On the other hand, STREAM.ISEQ
can't be written as

to stream.iseq :from :to ; wrong
if :from > :to [output []]
output stream :from [stream.iseq :from+1 :to]
end

because the promise won't be cashed in during this call to stream.iseq,
but rather, will be cashed in later, in a context in which :FROM and :TO
either don't exist or have different values. So we have to compute the
values of the inputs to the recursive call to STREAM.ISEQ *now*, while
we're making the promise. That's why stream-using procedures tend also to
use backquote, which partly evaluates a list -- we say

output stream :from `[stream.iseq ,[:from+1] ,:to]

The expressions following commas are evaluated by backquote, so it returns
something like [STREAM.ISEQ 3 999999].

(It follows, by the way, that streams are generally used in purely functional
programming; you can't put a local variable name in a promise, so you can't
use MAKE to change the value of a local variable.)

P.S. Streams are a little easier to do in Scheme because of its lexical
scope. Instead of using backquote as above, you'd wrap the promise in a
procedure: (lambda () (stream-iseq (+ from 1) to)). And Scheme lets users
create special forms, which don't evaluate their inputs, so you can say
(stream from (stream.iseq (+ from 1) to)) and Scheme provides the lambda
wrapper for you.

P.P.S. What I'm calling STREAM is called CONS.STREAM in Abelson and Sussman,
in case you read that.

Loading...