UCBLogo

Last updated
UCBLogo
Ubclogo spiral.png
UCBLogo allows for recursion, the process where a procedure calls itself. On the image, a spiral is produced by a recursive script.
Paradigms multi-paradigm:functional educational, procedural, reflective
Family Lisp
Designed by Brian Harvey
Developers Dan van Blerkom, Michael Katz, Doug Orleans.
Substantial contributions: Freeman Deutsch, Khang Dao, Fred Gilham, Yehuda Katz, George Mills, Sanford Owings, Randy Sargent [1]
First appeared1992;33 years ago (1992)
Stable release
6.2.4 / 2 July 2024;7 months ago (2024-07-02)
Typing discipline dynamic
Scope Dynamic
Implementation language C
Platform IA-32, x86-64
OS Windows, macOS, Linux
License GPL
Website people.eecs.berkeley.edu/~bh/logo.html
Influenced by
Lisp
Influenced
Smalltalk, Etoys, Scratch, NetLogo, KTurtle, Rebol

UCBLogo, also termed Berkeley Logo, is a programming language, a dialect of Logo, which derived from Lisp. It is a dialect of Logo intended to be a "minimum Logo standard". [2]

Contents

It has the best facilities for handling lists, files, input/output (I/O), and recursion. [3]

It can be used to teach most computer science concepts, as University of California, Berkeley lecturer Brian Harvey [4] did in his Computer Science Logo Style trilogy. [5] [6] [7] It is free and open-source software released under a GNU General Public License (GPL). [8]

Design

Logo was designed in spirit of low threshold and no ceiling, which enables easy entry by novices and yet meet the needs of high-powered users. UCBLogo has a rudimentary graphical user interface (GUI), so several projects exist that provide a better interface. MSWLogo and its successor FMSLogo , for Microsoft Windows, are commonly used in schools in the United Kingdom and Australia.[ citation needed ] For input/output (I/O), text may be written to the command window (output stream) using print and to the graphics window using label.

Animations require both the ability to draw and to erase shapes. The process is the same, except that in the former, a line is deposited on the display device and in the latter a line is removed. Using the turtle analogy, the turtle's pen must paint, and the turtle's pen must erase. The turtle can be set to erase anything below it, using the command PENERASE (PE), while the pen can be set to start drawing again with the command PENPAINT (PPT), in UCBLogo.

The pen

Turtle drawing a dotted line Ubclogo drawing dash.png
Turtle drawing a dotted line

The analogy of a turtle with a pen attached to its tail is often used. The turtle's pen can be lifted and lowered, thus drawing a rudimentary dotted line.

An example code:

FD20; draw a line and movePENUP; lift the pen so it draws nothingFD20; move and not drawPENDOWN; lower the pen so it draws againFD20; draw a line and movePENUP; lift the pen so it draws nothingFD40; move and not drawPENDOWN; lower the pen so it draws againRT20; rotate right (clockwise) 20 degrees

Data

There are three data types in UCBLogo: the word, the list, and the array (a number is a special case of word). The interpreter detects the datatype by context; there is no static typing.

Prefixing a variable with a colon (:) means the contents of, passing a variable by reference. The double quote symbol (") means the word is evaluated as itself: it is not paired as opening and closing quotes as happens in many other languages. A number is a special case of self-evaluation and can be used with or without a preceding quote.

Variable assignment is handled with the make command:

make "x sum :y 3 

make takes 2 parameters, the second of which here is sum :y "3. sum takes two 'parameters' and is an 'operation', thus the calculation is possible.

Variables do not have to be declared before use; their scope is then global. A variable may be declared local, then its scope is limited to that procedure and any procedures that it calls, which is termed dynamic scope . Calling a procedure with inputs (the name usually used for arguments in the Logo literature) also creates local variables that hold the argument values.

Logo inherits lists from Lisp, and they are its main method to store vectors. A list has the advantage over an array that it is infinitely expandable. A list can be considered to be a queue with the operators queue and dequeue, or a stack with the operations push and pop. A property list is a special list where the odd number items are property names, and the even are property values.

Logo provides several common control structures. There is one conditional structure, ifelse test [ do_if_true list ] [do_if_false list]. There are three iteration commands (while, until, and repeat). Recursion, rather than iteration, is Logo's preferred processing paradigm.

Logo also provides list-based control structures. The basic idea is of two lists:

OPERATION[alistofcommands][manydataitems]

Each of the commands is applied in turn to each of the data items. There are several of these template commands with names like MAP, APPLY, FILTER, FOREACH, REDUCE and CASCADE. They represent four flavours of template iteration, known as explicit-slot, named-procedure, named-slot (or Lambda), and procedure-text.

Syntax

Basic Chair Ucblogo.png
Basic Chair
Pattern Ubclogo function call.png
Pattern

Commands may be written on one line, or more. Many commands have mnemonic short forms; for example FORWARD and RIGHT are coded FD and RT respectively. This makes the input less onerous. Anything written after the ; (semicolon) is ignored, allowing the coder to insert comments.

; draws a square with sides 100 units longFORWARD100LEFT90FORWARD100LEFT90FORWARD100LEFT90FORWARD100LEFT90
FD100RT120FD100RT120; draws a triangleFD100RT120

The Hello World program in Logo looks like this:

 print [Hello World] 

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

Each line is made up of function calls, of which there are two types: commands (which usually do something—effects—but do not return a value) like print, and operations (which just return a value, its output) like sum, first or readlist.

A command is similar to a Pascal procedure, and an operation is similar to a Pascal function.. A special subset of operations, called predicates, which just output the word true or false, are conventionally written with a final p. Examples include emptyp, wordp, and listp. Expressions can be primitives, or can be defined by the user. Expressions can take zero, one or more parameters.

Procedures can be defined on the command line, using the TO ... END pair:

TO CHAIR REPEAT 4 [FD 100 RT 90]  FD 200 END

Logo can pass extra information to its words, and return information. The procedure (word) is instructed to expect something and give that something a name. The colon is used for this purpose.

See also

Related Research Articles

<span class="mw-page-title-main">Fortran</span> General-purpose programming language

Fortran is a third generation, compiled, imperative programming language that is especially suited to numeric computation and scientific computing.

<span class="mw-page-title-main">Logo (programming language)</span> Computer programming language

Logo is an educational programming language, designed in 1967 by Wally Feurzeig, Seymour Papert, and Cynthia Solomon. Logo is not an acronym: the name was coined by Feurzeig while he was at Bolt, Beranek and Newman, and derives from the Greek logos, meaning 'word' or 'thought'.

<span class="mw-page-title-main">Scheme (programming language)</span> Dialect of Lisp

Scheme is a dialect of the Lisp family of programming languages. Scheme was created during the 1970s at the MIT Computer Science and Artificial Intelligence Laboratory and released by its developers, Guy L. Steele and Gerald Jay Sussman, via a series of memos now known as the Lambda Papers. It was the first dialect of Lisp to choose lexical scope and the first to require implementations to perform tail-call optimization, giving stronger support for functional programming and associated techniques such as recursive algorithms. It was also one of the first programming languages to support first-class continuations. It had a significant influence on the effort that led to the development of Common Lisp.

Programmed Inquiry, Learning, or Teaching (PILOT) is a simple high-level programming language developed in the 1960s. Like its younger sibling LOGO, it was developed as an early foray into the technology of computer-assisted instruction.

In computer graphics, turtle graphics are vector graphics using a relative cursor upon a Cartesian plane. Turtle graphics is a key feature of the Logo programming language.

In computer programming, a parameter or a formal argument is a special kind of variable used in a subroutine to refer to one of the pieces of data provided as input to the subroutine. These pieces of data are the values of the arguments with which the subroutine is going to be called/invoked. An ordered list of parameters is usually included in the definition of a subroutine, so that, each time the subroutine is called, its arguments for that call are evaluated, and the resulting values can be assigned to the corresponding parameters.

<span class="mw-page-title-main">Reduce (computer algebra system)</span>

REDUCE is a general-purpose computer algebra system originally geared towards applications in physics.

The Shakespeare Programming Language (SPL) is an esoteric programming language designed by Jon Åslund and Karl Wiberg. Like the Chef programming language, it is designed to make programs appear to be something other than programs — in this case, Shakespearean plays.

A read–eval–print loop (REPL), also termed an interactive toplevel or language shell, is a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user; a program written in a REPL environment is executed piecewise. The term usually refers to programming interfaces similar to the classic Lisp machine interactive environment. Common examples include command-line shells and similar environments for programming languages, and the technique is very characteristic of scripting languages.

In computing, tee is a command in command-line interpreters (shells) using standard streams which reads standard input and writes it to both standard output and one or more files, effectively duplicating its input. It is primarily used in conjunction with pipes and filters. The command is named after the T-splitter used in plumbing.

Color BASIC is the implementation of Microsoft BASIC that is included in the ROM of the Tandy/Radio Shack TRS-80 Color Computers manufactured between 1980 and 1991. BASIC is a high level language with simple syntax that makes it easy to write simple programs. Color BASIC is interpreted, that is, decoded as it is run.

TUTOR, also known as PLATO Author Language, is a programming language developed for use on the PLATO system at the University of Illinois at Urbana-Champaign beginning in roughly 1965. TUTOR was initially designed by Paul Tenczar for use in computer assisted instruction (CAI) and computer managed instruction (CMI) and has many features for that purpose. For example, TUTOR has powerful answer-parsing and answer-judging commands, graphics, and features to simplify handling student records and statistics by instructors. TUTOR's flexibility, in combination with PLATO's computational power, also made it suitable for the creation of games — including flight simulators, war games, dungeon style multiplayer role-playing games, card games, word games, and medical lesson games such as Bugs and Drugs (BND). TUTOR lives on today as the programming language for the Cyber1 PLATO System, which runs most of the source code from 1980s PLATO and has roughly 5000 users as of June 2020.

<span class="mw-page-title-main">MSWLogo</span> Programming language

MSWLogo is a programming language which is interpreted, based on the computer language Logo, with a graphical user interface (GUI) front end. George Mills developed it at the Massachusetts Institute of Technology (MIT). Its core is the same as UCBLogo by Brian Harvey. It is free and open-source software, with source code available, in Borland C++.

ReGIS, short for Remote Graphic Instruction Set, is a vector graphics markup language developed by Digital Equipment Corporation (DEC) for later models of their famous VT series of computer terminals. ReGIS supports rudimentary vector graphics consisting of lines, circular arcs, and similar shapes. Terminals supporting ReGIS generally allow graphics and text to be mixed on-screen, which makes the construction of graphs and charts relatively easy.

<span class="mw-page-title-main">Microsoft Small Basic</span> Programming language dialect and development environment

Microsoft Small Basic is a programming language, interpreter and associated IDE. Microsoft's simplified variant of BASIC, it is designed to help students who have learnt visual programming languages such as Scratch learn text-based programming. The associated IDE provides a simplified programming environment with functionality such as syntax highlighting, intelligent code completion, and in-editor documentation access. The language has only 14 keywords.

<span class="mw-page-title-main">Brian Harvey (lecturer)</span> American computer scientist

Brian Keith Harvey is a former Lecturer SOE of computer science at University of California, Berkeley. He and his students developed an educational programming language named UCBLogo which is free and open-source software, a dialect of the language Logo, as an interpreter, for learners. He now works on Snap!.

Snap<i>!</i> (programming language) Block-based programming language

Snap! is a free block-based educational graphical programming language and online community. Snap allows students to explore, create, and remix interactive animations, games, stories, and more, while learning about mathematical and computational ideas. While inspired by Scratch, Snap! has many advanced features. The Snap! editor, and programs created in it, are web applications that run in the browser without requiring installation. It is built on top of Morphic.js, a Morphic GUI, written by Jens Mönig as 'middle layer' between Snap! itself and 'bare' JavaScript.

<span class="mw-page-title-main">LibreLogo</span> Vector graphics language

LibreLogo is an integrated development environment (IDE) for computer programming in the programming language Python, which works like the language Logo using interactive vector turtle graphics. Its final output is a vector graphics rendition within the LibreOffice suite. It can be used for education and desktop publishing.

<span class="mw-page-title-main">PascalABC.NET</span> Computer programming language

PascalABC.NET is a high-level general-purpose programming language supporting multiple paradigms. PascalABC.NET is based on Delphi's Object Pascal, but also has influences from C#, Python, Kotlin, and Haskell. It is distributed both as a command-line tool for Windows, Linux and MacOS (Mono), and with an integrated development environment for Windows and Linux, including interactive debugger, IntelliSense system, form designer, code templates and code auto-formatting.

BASIC 1.0 is the standard BASIC language for Thomson computers, which is the reference for the entire range. This is an implementation of Microsoft BASIC (BASIC-69). It was used to introduce children from France to programming in the 1980s. Three languages were mainly taught: LSE, BASIC and LOGO. School textbooks programs were given in BASIC 1.0 for Thomson and sometimes in ExelBasic for the Exelvision EXL 100.

References

  1. Harvey, Brian (1997). Volume 1: Symbolic Computing: Acknowledgments. Computer Science Logo Style. Vol. 1. MIT Press. ISBN   0-262-58148-5 . Retrieved 2019-05-06.{{cite book}}: |website= ignored (help)
  2. Solomon, Cynthia; Harvey, Brian; Kahn, Ken; Lieberman, Henry; Miller, Mark; Minsky, Margaret; Papert, Artemis; Silverman, Brian (June 2020). "History of Logo". Proc. ACM Program. Lang. 4: 1–66. doi:10.1145/3386329. hdl: 1721.1/133952 . S2CID   219012246.
  3. "Logo Programming Language". Logo Foundation. 2012. Archived from the original on 2013-08-15. Retrieved 2019-05-06.
  4. Harvey, Brian. "Brian Harvey". Electrical Engineering and Computer Sciences. University of California, Berkeley. Retrieved 2019-05-06.
  5. Harvey, Brian (1997). Volume 1: Symbolic Computing. Computer Science Logo Style. Vol. 1. MIT Press. ISBN   0-262-58148-5 . Retrieved 2019-05-06.{{cite book}}: |website= ignored (help)
  6. Harvey, Brian (1997). Volume 2: Advanced Techniques. Computer Science Logo Style. Vol. 2. MIT Press. ISBN   0-262-58149-3 . Retrieved 2019-05-06.{{cite book}}: |website= ignored (help)
  7. Harvey, Brian (1997). Volume 3: Beyond Programming. Computer Science Logo Style. Vol. 3. MIT Press. ISBN   0-262-58150-7 . Retrieved 2019-05-06.{{cite book}}: |website= ignored (help)
  8. Harvey, Brian (2008-09-14). "Release 6.0 of Berkeley Logo is now available by anonymous FTP or Web". Electrical Engineering and Computer Sciences. University of California, Berkeley. Retrieved 2019-05-09.